I'm wanting to use a range of Python libraries in my Julia code. I've been trying to use PyCall to access the Python libraries I have installed on my (windows) PC already; however, I have been unable to reconfigure PyCall away from its default Python distribution which is private to Julia. Following the steps in the documentation (https://github.com/JuliaPy/PyCall.jl), I attempted the following in Julia:
using Pkg
ENV["PYTHON"] = raw"C:\Users\catod\AppData\Local\Programs\Python\Python37-32\python.exe"
Pkg.build(PyCall)
After exiting and reentering Julia, I attempted to run
using PyCall
plt = pyimport("matplotlib.pyplot")
but got the following error message:
ERROR: LoadError: PyError (PyImport_ImportModule
The Python package matplotlib.pyplot could not be imported by pyimport. Usually this means
that you did not install matplotlib.pyplot in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the matplotlib.pyplot module, you can
use `pyimport_conda("matplotlib.pyplot", PKG)`, where PKG is the Anaconda
package the contains the module matplotlib.pyplot, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")
Can anyone point out where I have gone wrong?