PyPlot.jl
PyPlot.jl copied to clipboard
PyPlot 2.3.2 with Conda python hangs julia 0.6.2 on macOS
On OSX building PyCall/PyPlot with Conda version of python, closing a plot hangs julia v0.6.2. Force quit is needed to kill julia. By way of more details, below I added the output from starting with a clean .julia directory in my home directory and using the 0.6.2 app from the Julia website. Simply typing using PyPlot crashes.
et-imac-retina:~ sjbespa$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__'_|_|_|\__'_| |
|__/ | x86_64-apple-darwin17.3.0
julia> ENV["PYTHON"]=""
""
julia> Pkg.add("PyCall")
INFO: Installing Conda v0.7.1
INFO: Installing PyCall v1.15.0
INFO: Building Conda
INFO: Building PyCall
INFO: Using the Python distribution in the Conda package by default.
To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-run Pkg.build("PyCall").
Solving environment: done
# All requested packages already installed.
INFO: PyCall is using /Users/sjbespa/.julia/v0.6/Conda/deps/usr/bin/python (Python 2.7.14) at /Users/sjbespa/.julia/v0.6/Conda/deps/usr/bin/python, libpython = /Users/sjbespa/.julia/v0.6/Conda/deps/usr/lib/libpython2.7
INFO: /Users/sjbespa/.julia/v0.6/PyCall/deps/deps.jl has not changed
INFO: /Users/sjbespa/.julia/v0.6/PyCall/deps/PYTHON has not changed
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of PyCall
INFO: Use `Pkg.update()` to get the latest versions of your packages
julia> Pkg.add("PyPlot")
INFO: Installing LaTeXStrings v0.3.0
INFO: Installing PyPlot v2.3.2
INFO: Building Conda
INFO: Building PyCall
INFO: Using the Python distribution in the Conda package by default.
To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-run Pkg.build("PyCall").
Solving environment: done
# All requested packages already installed.
INFO: PyCall is using /Users/sjbespa/.julia/v0.6/Conda/deps/usr/bin/python (Python 2.7.14) at /Users/sjbespa/.julia/v0.6/Conda/deps/usr/bin/python, libpython = /Users/sjbespa/.julia/v0.6/Conda/deps/usr/lib/libpython2.7
INFO: /Users/sjbespa/.julia/v0.6/PyCall/deps/deps.jl has not changed
INFO: /Users/sjbespa/.julia/v0.6/PyCall/deps/PYTHON has not changed
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of PyPlot
INFO: Use `Pkg.update()` to get the latest versions of your packages
julia> using PyPlot
INFO: Recompiling stale cache file /Users/sjbespa/.julia/lib/v0.6/PyPlot.ji for module PyPlot.
julia> plot(1:10,1:10)
[Restored Jan 26, 2018 at 11:02:43 AM]
Crash starting with clean .julia directory and the julia app from the website:
et-imac-retina:~ sjbespa$ exec '/Users/sjbespa/Desktop/Julia-0.6-2.app/Contents/Resources/julia/bin/julia'
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-apple-darwin14.5.0
julia> Pkg.add("PyPlot")
INFO: Initializing package repository /Users/sjbespa/.julia/v0.6
INFO: Cloning METADATA from https://github.com/JuliaLang/METADATA.jl
...
Downloading and Extracting Packages
singledispatch 3.4.0.3: ############################################################################################ | 100%
...
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR: InitError: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)
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.
) <type 'exceptions.ImportError'>
ImportError('No module named mpl_toolkits.mplot3d',)
Stacktrace:
[1] pyerr_check at /Users/sjbespa/.julia/v0.6/PyCall/src/exception.jl:56 [inlined]
[2] pyerr_check at /Users/sjbespa/.julia/v0.6/PyCall/src/exception.jl:61 [inlined]
[3] macro expansion at /Users/sjbespa/.julia/v0.6/PyCall/src/exception.jl:81 [inlined]
[4] pyimport(::String) at /Users/sjbespa/.julia/v0.6/PyCall/src/PyCall.jl:374
[5] __init__() at /Users/sjbespa/.julia/v0.6/PyPlot/src/init.jl:205
[6] _include_from_serialized(::String) at ./loading.jl:157
[7] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200
[8] _require(::Symbol) at ./loading.jl:498
[9] require(::Symbol) at ./loading.jl:405
during initialization of module PyPlot
This might be a problem with Conda rather than PyPlot? I'm also on OS X and Julia v0.6.2, and I was able to workaround this problem by using the system python installation and rebuilding PyCall and PyPlot.