Closed BoundaryValueProblems closed 4 years ago
What happens if you do
using PyCall
pyimport("matplotlib")
?
@stevengj , here is the error I got by doing so. Thanks for your further help!
julia> pyimport("matplotlib")
ERROR: PyError (PyImport_ImportModule
The Python package matplotlib could not be found by pyimport. Usually this means
that you did not install matplotlib 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 module, you can
use `pyimport_conda("matplotlib", PKG)`, where PKG is the Anaconda
package the contains the module matplotlib, 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 'ImportError'>
ImportError('\n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy c-extensions failed.\n- Try uninstalling and reinstalling numpy.\n- If you have already done that, then:\n 1. Check that you expected to use Python3.6 from "C:\\Program Files\\Julia-1.3.0\\bin\\julia.exe",\n and that you have no directories in your PATH or PYTHONPATH that can\n interfere with the Python and numpy version "1.17.4" you\'re trying to use.\n 2. If (1) looks fine, you can open a new issue at\n https://github.com/numpy/numpy/issues. Please include details on:\n - how you installed Python\n - how you installed numpy\n - your operating system\n - whether or not you have multiple versions of Python installed\n - if you built from source, your compiler versions and ideally a build log\n\n- If you\'re working with a numpy git repository, try `git clean -xdf`\n (removes all files not under version control) and rebuild numpy.\n\nNote: this error has many possible causes, so please don\'t comment on\nan existing issue about this - open a new one instead.\n\nOriginal error was: DLL load failed: The specified module could not be found.\n',)
File "C:\Users\xxx\.julia\conda\3\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "C:\Users\xxx\.julia\conda\3\lib\site-packages\matplotlib\cbook\__init__.py", line 31, in <module>
import numpy as np
File "C:\Users\xxx\.julia\conda\3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\xxx\.julia\conda\3\lib\site-packages\numpy\core\__init__.py", line 47, in <module>
raise ImportError(msg)
Stacktrace:
[1] pyimport(::String) at C:\Users\xxx\.julia\packages\PyCall\ttONZ\src\PyCall.jl:544
[2] top-level scope at none:0
Is this an numpy
issue? I tried pyimport("numpy")
and got the same error messages. Yet, I already installed numpy
v1.17.4 via Conda. So, I'm quite puzzled...
@stevengj I resolved the problem now. I would appreciate it if you could take a look at my posting https://github.com/JuliaPy/PyCall.jl/issues/730. Somehow, if I update various python packages via Conda.update()
, then all these troubles occur...
Seems to be a PATH issue in PyCall (see JuliaPy/PyCall.jl#730), not due to PyPlot per se.
Hello.
I'm facing difficulty to use PyPlot on my windows 10 machine. The versions I'm using are: Julia v1.3.0; Conda v1.3.0; PyCall v1.91.2; PyPlot v2.8.2. I already installed the latest matlibplot via
Conda.update()
, and it's v3.1.1 now. Also, the python executable used by PyCall seems to be correctly specified:Then, I got the following errors. Essentially, PyPlot keeps trying to install matplotlib even though it was already installed. In fact, the warnings below say "All requested packages already installed." Yet, each time when I try to use PyPlot, this happens and I cannot use it on windows. It works under macOS though. I would greatly appreciate it if someone could tell me what to do. Thanks!