JuliaPy / PyPlot.jl

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

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

Open hellolj opened 10 years ago

hellolj commented 10 years ago

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,

stevengj commented 10 years ago

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

lucasb-eyer commented 10 years ago

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.

hellolj commented 10 years ago

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 notifications@github.comwrote:

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 .