Call Python functions from Julia / Lorenz Attractor Example

question
package
plotting

#1

Hello,

I was wondering how I best get Python functions running in Julia.

The Lorenz attractor example in
http://docs.juliaplots.org/latest/
isn’t working for me. The error message I get is

The Python package mpl_toolkits.mplot3d could not be found by pyimport. Usually this means
that you did not install mpl_toolkits.mplot3d in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the mpl_toolkits.mplot3d module, you can
use pyimport_conda("mpl_toolkits.mplot3d", PKG), where PKG is the Anaconda
package the contains the module mpl_toolkits.mplot3d, or alternatively you can use the
Conda package directly (via using Conda followed by Conda.add etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV[“PYTHON”] to the path/name of the python executable
you want to use, run Pkg.build(“PyCall”), and re-launch Julia.

I would be happy to get it running and reproduce the plot.

Any thoughts?


#2

Use a backend that’s not PyPlot. I would start with the tutorial.

http://docs.juliaplots.org/latest/tutorial/


#3

You might find a solution here. Maybe the very last one from stevengj.

EDIT: As @ChrisRackauckas mentioned, at least for beginners, PyPlot is probably not the best package for plotting in Julia as one can easily run into installation problems.


#4

Ehh, I would still just try to avoid Python packages. They seem so unpredictable and tough to install. Using GR or Plotly avoids Python and thus avoids all of the issues that Conda/pip have.


#5

I don’t disagree that one can easily run into installation problems with PyPlot and didn’t make a recommendation. My link is simply supposed to help him and anyone who wants to use PyPlot (maybe for a good reason).

(BTW: I almost exclusively use PyPlot for all my work because I know matplotlib inside out and in my eyes there is no pure Julia equivalent yet.)


#6

It seems to run on some computers. But the error message I usually get on my computer is

LoadError:
(::Atom.##110#114{String,String})() at eval.jl:104
withpath(::Atom.##110#114{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
didWriteToREPL(::Atom.##109#113{String,String}) at repl.jl:129
hideprompt(::Atom.##109#113{String,String}) at repl.jl:65
macro expansion at eval.jl:99 [inlined]
(::Atom.##108#112{Dict{String,Any}})() at task.jl:80

most of the time some error in utils.jl

Is there anything I can do about it?