Closed stevengj closed 4 years ago
(v1.3) pkg> add Conda#unpin_windows
(v1.3) pkg> build PyCall
(v1.3) pkg> build PyPlot
julia> using PyPlot
ERROR: InitError: 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.7 from "C:\\Users\\wangc\\AppData\\Local\\Julia-1.3.1\\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.18.1" 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\wangc\.julia\conda\3\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "C:\Users\wangc\.julia\conda\3\lib\site-packages\matplotlib\cbook\__init__.py", line 31, in <module>
import numpy as np
File "C:\Users\wangc\.julia\conda\3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\wangc\.julia\conda\3\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
Stacktrace:
[1] pyimport(::String) at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:544
[2] pyimport_conda(::String, ::String, ::String) at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:708
[3] pyimport_conda at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:701 [inlined]
[4] __init__() at C:\Users\wangc\.julia\packages\PyPlot\4wzW1\src\init.jl:179
[5] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:692
[6] _require_from_serialized(::String) at .\loading.jl:743
[7] _require(::Base.PkgId) at .\loading.jl:1034
[8] require(::Base.PkgId) at .\loading.jl:922
[9] require(::Module, ::Symbol) at .\loading.jl:917
during initialization of module PyPlot
caused by [exception 1]
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 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")
Stacktrace:
[1] pyimport(::String) at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:544
[2] pyimport_conda(::String, ::String, ::String) at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:702
[3] pyimport_conda at C:\Users\wangc\.julia\packages\PyCall\ttONZ\src\PyCall.jl:701 [inlined]
[4] __init__() at C:\Users\wangc\.julia\packages\PyPlot\4wzW1\src\init.jl:179
[5] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:692
[6] _require_from_serialized(::String) at .\loading.jl:743
[7] _require(::Base.PkgId) at .\loading.jl:1034
[8] require(::Base.PkgId) at .\loading.jl:922
[9] require(::Module, ::Symbol) at .\loading.jl:917
@mistguy, is this with a fresh system, or one where you already installed Conda? If you already have Conda installed, just doing add Conda
again will not install a new Anaconda distro. You have to remove Conda.ROOTENV
first.
@mistguy, is this with a fresh system, or one where you already installed Conda? If you already have Conda installed, just doing
add Conda
again will not install a new Anaconda distro. You have to removeConda.ROOTENV
first.
It is a fresh system. I uninstalled the original miniconda first. There were "install miniconda", "install matplotlib" stuff during the process. I simply deleted it for clarity in https://github.com/JuliaPy/Conda.jl/pull/170#issuecomment-584874054
@mistguy, I can reproduce — it's an unrelated PATH issue with PyCall that is triggered by the latest Anaconda version: https://github.com/JuliaPy/PyCall.jl/issues/730#issuecomment-584887889
Then why this pull request is merged? I have not seen a solution besides pin python=3.6.5.
As explained in the linked comment, there is a solution by modifying the PATH, and I'll push a PR to PyCall shortly to do that.
I understand, but the comment (https://github.com/JuliaPy/Conda.jl/issues/119#issuecomment-508168853) says it's not just BINDIR that needs to be in PATH.
Matplotlib works fine with just the bindir.
Reverts #124, which was a "temporary" workaround from 2 years ago that we forgot about, and is now breaking things on Windows — it pins the Windows Python at 3.6, which nowadays seems to be broken.
cc @tkf, @ranjanan