-
-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I'm trying to configure the python executable for running matplotlib to one in a virtual environment. I need to do this to have access to all the installed packages there. Unfortunately pandoc-plot seems to ignore the setting and still runs the system version of python.
Specifically I have a source script that looks something like the following, where some_package is a package installed only in the venv:
```{.matplotlib executable="/full/path/to/venv/bin/python"}
import sys
print(f"sys.executable={sys.executable}", file=sys.stderr)
import some_package
```
With this in a markdown file and converting it with pandoc + pandoc-plot, pandoc-plot would give something like following:
[pandoc-plot] ERROR | Running command
[pandoc-plot] ERROR | python "/tmp/pandocplot4826263390304275862.py"
[pandoc-plot] ERROR | ended with exit code ExitFailure 1
[pandoc-plot] ERROR | *******
[pandoc-plot] ERROR | sys.executable=/usr/bin/python
[pandoc-plot] ERROR | Traceback (most recent call last):
[pandoc-plot] ERROR | File "/tmp/pandocplot4826263390304275862.py", line 9, in <module>
[pandoc-plot] ERROR | import some_package
[pandoc-plot] ERROR | ModuleNotFoundError: No module named 'some_package'
[pandoc-plot] ERROR |
[pandoc-plot] ERROR | *******
[pandoc-plot] ERROR | Command "python "/tmp/pandocplot4826263390304275862.py"" failed with exit code 1. The script source was:
[pandoc-plot] ERROR |
[pandoc-plot] ERROR | 1 > import sys
[pandoc-plot] ERROR | 2 > print(f"sys.executable={sys.executable}", file=sys.stderr)
[pandoc-plot] ERROR | 3 > import some_package
[pandoc-plot] ERROR |
Note that running the venv version of python directly and executing the above script works as expected: it prints the path to the virtual environment's executable (i.e '/full/path/to/venv/bin/python') and correctly imports the package.
I experimented with not setting the executable at all, and noticed that pandoc-plot seems to default to using the python3 executable. That means that my configuration is being read, but the absolute path is being lost somewhere.