I am building a package and have a submodule that uses PyPlot. The main package does not. When I try
using MyPkg
I get a complaint unless PyPlot is in the Project.toml. Having put it in and pushed the new material, I get this from documenter (using github actions)
1m 10s
33
) <class 'ModuleNotFoundError'>
1
Run julia --project=docs --color=yes docs/make.jl
7
ERROR: LoadError: InitError: PyError (PyImport_ImportModule
8
9
The Python package matplotlib could not be found by pyimport. Usually this means
10
that you did not install matplotlib in the Python version being used by PyCall.
11
12
PyCall is currently configured to use the Python version at:
13
14
/usr/bin/python3
15
16
and you should use whatever mechanism you usually use (apt-get, pip, conda,
17
etcetera) to install the Python package containing the matplotlib module.
18
19
One alternative is to re-configure PyCall to use a different Python
20
version on your system: set ENV["PYTHON"] to the path/name of the python
21
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
22
23
Another alternative is to configure PyCall to use a Julia-specific Python
24
distribution via the Conda.jl package (which installs a private Anaconda
25
Python distribution), which has the advantage that packages can be installed
26
and kept up-to-date via Julia. As explained in the PyCall documentation,
27
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
28
To install the matplotlib module, you can use `pyimport_conda("matplotlib", PKG)`,
29
where PKG is the Anaconda package the contains the module matplotlib,
30
or alternatively you can use the Conda package directly (via
31
`using Conda` followed by `Conda.add` etcetera).
32
33
) <class 'ModuleNotFoundError'>
Is there anything I can do about this?