PyPlot.jl icon indicating copy to clipboard operation
PyPlot.jl copied to clipboard

ImportError("No module named 'matplotlib'",)

Open hellolj opened this issue 12 years ago • 3 comments

I complied Julia under Archlinux. Successfully added PyPlot package, but failed in loading it:

julia> using(PyPlot)
ERROR: PyError (PyImport_ImportModule) <class 'ImportError'>
ImportError("No module named 'matplotlib'",)

 in pyerr_check at /home/hellolj/.julia/PyCall/src/exception.jl:58
 in pyimport at /home/hellolj/.julia/PyCall/src/PyCall.jl:85
 in reload_path at loading.jl:146
 in _require at loading.jl:59
 in require at loading.jl:43
while loading /home/hellolj/.julia/PyPlot/src/PyPlot.jl, in expression starting on line 32

I suspect that this error happened because under Arch Linux, ipython 2.7 is named ipython2 insteady of ipython by default on Julia side.

Can anyone help with this issue?

Thanks,

hellolj avatar Jan 03 '14 14:01 hellolj

If you run python and then (at the Python command-line) run import matplotlib, does it work? (i.e. do you have matplotlib installed)?

In general, if you have multiple versions of Python installed on your system, you will have problems if you install matplotlib for one Python version but are running another Python version from Julia. (Julia runs python by default.)

(The ipython2 issue should be fixed in IJulia.)

stevengj avatar Jan 03 '14 16:01 stevengj

I can use PyPlot from IJulia with an IPython called ipython3, so I don't think it's that. Another thing you could check is using PyCall; @pyimport numpy in julia.

If by any chance you are inside a virtualenv, see stevengj/PyCall.jl#57.

lucasb-eyer avatar Jan 03 '14 22:01 lucasb-eyer

Yes I had python2-matplotlib installed. It works fine with ipython2.

I have just installed both "python" and "python-matplotlib" package in Arch Linux, which is actually based on python 3.3.3.

PyPlot now could be loaded properly. No further issue currently.

It should be the same problem as with Ijulia, both of which cannot recognize Archlinux's ipython2 installation.

Thanks for fixing the problem with IJulia.

On Sat, Jan 4, 2014 at 3:21 AM, Steven G. Johnson [email protected]:

If you run python and then (at the Python command-line) run import matplotlib, does it work? (i.e. do you have matplotlib installed)?

In general, if you have multiple versions of Python installed on your system, you will have problems if you install matplotlib for one Python version but are running another Python version from Julia. (Julia runs python by default.)

(The ipython2 issue should be fixed in IJulia.)

— Reply to this email directly or view it on GitHubhttps://github.com/stevengj/PyPlot.jl/issues/28#issuecomment-31535414 .

hellolj avatar Jan 04 '14 02:01 hellolj