JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
478 stars 88 forks source link

`using PyPlot` fails #430

Closed crbinz closed 5 years ago

crbinz commented 5 years ago

On Windows 7, julia 1.1.0:

julia> using PyPlot
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Collecting package metadata: done
Solving environment: done

# All requested packages already installed.

ERROR: InitError: PyError (PyImport_ImportModule) <class 'AttributeError'>
AttributeError("module 'numpy' has no attribute '__version__'",)
  File "C:\Users\cbinz\.julia\conda\3\lib\site-packages\matplotlib\__init__.py", line 210, in <module>
    if not compare_versions(numpy.__version__, __version__numpy__):

Stacktrace:
 [1] pyimport(::String) at C:\Users\cbinz\.julia\packages\PyCall\RQjD7\src\PyCall.jl:537
 [2] pyimport_conda(::String, ::String, ::String) at C:\Users\cbinz\.julia\packages\PyCall\RQjD7\src\PyCall.jl:701
 [3] pyimport_conda at C:\Users\cbinz\.julia\packages\PyCall\RQjD7\src\PyCall.jl:694 [inlined]
 [4] __init__() at C:\Users\cbinz\.julia\packages\PyPlot\KRYZs\src\init.jl:167
 [5] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:633
 [6] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:713
 [7] _require(::Base.PkgId) at .\loading.jl:937
 [8] require(::Base.PkgId) at .\loading.jl:858
 [9] require(::Module, ::Symbol) at .\loading.jl:853
during initialization of module PyPlot

This is after I do ENV["PYTHON"]=""; Pkg.build("PyCall") and ]add PyPlot, both of which complete successfully.

stevengj commented 5 years ago

module 'numpy' has no attribute '__version__'

I haven't seen that error before. Note that the error occurs inside matplotlib. This would seem to indicate that your Python installation is broken somehow.

Maybe it will help to update the conda installation (do add Conda at the package prompt first):

using Conda
Conda.update()

?

If not, you could try removing Conda and reinstalling

rm(raw"C:\Users\cbinz\.julia\conda", recursive=true)

and then re-run build PyCall at the package prompt.

crbinz commented 5 years ago

Updating Conda didn't fix things, but nuking ~/.julia/conda did. :man_shrugging: