Skip to content

PyPlot keeps trying to install matplotlib even if it's already installed (Windows 10) #461

@BoundaryValueProblems

Description

@BoundaryValueProblems

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:

julia> using PyCall
julia> PyCall.python
"C:\\Users\\xxx\\.julia\\conda\\3\\python.exe"

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!

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

# All requested packages already installed.

ERROR: InitError: PyCall.PyError("PyImport_ImportModule\n\nThe Python package matplotlib could not be found by pyimport. Usually this means\nthat you did not install matplotlib in the Python version being used by PyCall.\n\nPyCall is currently configured to use the Julia-specific Python distribution\ninstalled by the Conda.jl package.  To install the matplotlib module, you can\nuse `pyimport_conda(\"matplotlib\", PKG)`, where PKG is the Anaconda\npackage the contains the module matplotlib, or alternatively you can use the\nConda package directly (via `using Conda` followed 
by `Conda.add` etcetera).\n\nAlternatively, if you want to use a different Python distribution on your\nsystem, such as a system-wide Python (as 
opposed to the Julia-specific Python),\nyou can re-configure PyCall with that Python.   As explained in the PyCall\ndocumentation, set ENV[\"PYTHON\"] to the path/name of the python executable\nyou want to use, run Pkg.build(\"PyCall\"), and re-launch Julia.\n\n", PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x000000006b8a4290), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x0000000030ba39e8), PyCall.PyObject(Ptr{PyCall.PyObject_struct} @0x0000000030bae888))
Stacktrace:
 [1] pyimport(::String) at C:\Users\xxx\.julia\packages\PyCall\ttONZ\src\PyCall.jl:544
 [2] pyimport_conda(::String, ::String, ::String) at C:\Users\xxx\.julia\packages\PyCall\ttONZ\src\PyCall.jl:708
 [3] pyimport_conda at C:\Users\xxx\.julia\packages\PyCall\ttONZ\src\PyCall.jl:701 [inlined]
 [4] __init__() at C:\Users\xxx\.julia\packages\PyPlot\4wzW1\src\init.jl:179
 [5] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:692
 [6] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:776
 [7] _require(::Base.PkgId) at .\loading.jl:1001
 [8] require(::Base.PkgId) at .\loading.jl:922
 [9] require(::Module, ::Symbol) at .\loading.jl:917
during initialization of module PyPlot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions