PyPlot.jl
PyPlot.jl copied to clipboard
import PyPlot fails
Hi,
I have problems importing PyPlot on different CentOS 7 and Fedora 20 machines:
julia> import PyPlot
Warning: error initializing module PyPlot:
PyCall.PyError(msg=":PyImport_ImportModule", T=PyCall.PyObject(o=0x0000000001d86520), val=PyCall.PyObject(o=0x000000000a5b1e18), traceback=PyCall.PyObject(o=0x0000000000000000))
Importing PyCall (only) works fine:
julia> import PyCall
julia> PyCall.pyinitialize()
Any idea how to fix the problem?
Regards, Josef
What happens if you manually do:
import PyCall
@pyimport matplotlib.pyplot as plt
?
Here is the result:
julia> import PyCall
julia> @PyCall.pyimport matplotlib.pyplot as plt
ERROR: PyError (:PyImport_ImportModule) <type 'exceptions.ImportError'>
ImportError('No module named matplotlib.pyplot',)
in pyerr_check at /usr/local/lib/julia/v0.3/PyCall/src/exception.jl:58
in pyimport at /usr/local/lib/julia/v0.3/PyCall/src/PyCall.jl:91
My mistake; the default Python interpreter did not have matplotlib installed - sorry.
I corrected the path, but now I get an import error for the module 'site':
ImportError: No module named site
Importing 'site' in Python works fine.
Are you using Enthought Canopy? If so, this is due to stevengj/PyCall.jl#42 ... I would recommend Anacona Python.
I am using our "own" Python distribution, because we have much more packages installed than provided by Canopy or Anaconda. But, Anaconda is also installed on all of our desktops and it works. Nevertheless, I want to find out why the site package cannot be found (with our Python distribution) ...
Basically, my understanding is that that error means that some kind of path is not being set up correctly (when we initialize python via libpython) that is set when you run the python executable....