Simple Python "import csv" failed to executed
Describe GraalVM and your environment :
- GraalVM version or commit id if built from source: [e.g. 19.3]
- CE or EE: [e.g.: CE]
- JDK version: [e.g.: JDK8]
- OS and OS Version: [e.g.: macOS Catalina]
- Architecture: [e.g.: amd64]
- The output of
java -Xinternalversion:
Java HotSpot(TM) 64-Bit Server VM (17.0.9+11-LTS-jvmci-23.0-b21) for bsd-aarch64 JRE (17.0.9+11-LTS-jvmci-23.0-b21), built on Oct 11 2023 12:38:03 by "graal1" with clang Apple LLVM 12.0.0 (clang-1200.0.32.29)
mac aarch64 jdk21 23.1.0
Have you verified this issue still happens when using the latest snapshot? Yes
Describe the issue
ModuleNotFoundError: No module named 'csv'
at
Code snippet or code repository that reproduces the issue
String venvExePath = Paths.get("testenv", "bin", "graalpy").toString();
Context context = Context.newBuilder().allowAllAccess(true).option("python.Executable", venvExePath).build();
context.eval("python", "import site");
context.eval("python", "import csv"); // <--- error here
Steps to reproduce the issue
Expected behavior No error should occur and in the python code it will have access to csv.Sniffer etc.
Additional context Add any other context about the problem here. Specially important are stack traces or log output. Feel free to link to gists or to screenshots if necesary
Details
ModuleNotFoundError: No module named 'csv'
at <python> <module>(Unknown)
at org.graalvm.polyglot/org.graalvm.polyglot.Context.eval(Context.java:428)
Do you use Python via the maven dependencies? csv is in the standard library and should be available when depending on org.graalvm.py/python-resources (either directly or indirectly via the org.graalvm.polyglot/python dependency). You will need file system access also, since the python-resources are automatically extracted to the user's cache folder on startup.
There has been no response to Tim's question for many months, so I'm going to close this issue for insufficient information. Feel free to reopen the issue when you provide more information on how to reproduce.