Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpin Anaconda on Windows #170

Merged
merged 1 commit into from
Feb 11, 2020
Merged

unpin Anaconda on Windows #170

merged 1 commit into from
Feb 11, 2020

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Feb 11, 2020

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

@atbug
Copy link

atbug commented Feb 11, 2020

(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

@stevengj
Copy link
Member Author

@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.

@atbug
Copy link

atbug commented Feb 11, 2020

@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.

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 #170 (comment)

@stevengj
Copy link
Member Author

@Mistguy, I can reproduce — it's an unrelated PATH issue with PyCall that is triggered by the latest Anaconda version: JuliaPy/PyCall.jl#730 (comment)

@stevengj stevengj merged commit ea4d3d3 into master Feb 11, 2020
@stevengj stevengj deleted the unpin_windows branch February 11, 2020 22:29
@atbug
Copy link

atbug commented Feb 11, 2020

Then why this pull request is merged? I have not seen a solution besides pin python=3.6.5.

@stevengj
Copy link
Member Author

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.

@atbug
Copy link

atbug commented Feb 12, 2020

I understand, but the comment (#119 (comment)) says it's not just BINDIR that needs to be in PATH.

@stevengj
Copy link
Member Author

Matplotlib works fine with just the bindir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants