PyPlot Won't Precompile Julia 5.0

Hello.

I’m keen to try Julia after being a Matlab user for over 15 years. Embarrassingly, I’m struggling to get the environment set up. I have a MacBook Pro and the OS is up to date. I have installed that latest version of Anaconda to get a good Python environment. I have installed the latest version of Julia (5.0) from the julialang.org website. While simple commands like 2+2 work just fine, when I try to include packages, such as PyPlot, they will not precompile.

As an example of the errors I get, see:

julia> Pkg.update( )
INFO: Updating METADATA…
INFO: Updating Compat master…
INFO: Updating CodeTools master…
INFO: Computing changes…
INFO: No packages to install, update or remove

julia> Pkg.update( “PyPlot” )
INFO: Updating METADATA…
INFO: Updating Compat master…
INFO: Computing changes…
INFO: Package PyPlot was set to version 2.1.0, but a higher version 2.3.2 exists.
To install the latest version, you could try doing a full update with Pkg.update().
INFO: No packages to install, update or remove

julia> using PyPlot
INFO: Precompiling module PyPlot.

WARNING: deprecated syntax “(AbstractString=>Any)[a=>b for (a,b) in c]” at /Users/gsmith/.julia/v0.5/PyCall/src/PyCall.jl:395.
Use “Dict{AbstractString,Any}(a=>b for (a,b) in c)” instead.
ERROR: LoadError: LoadError: wstring has been moved to the package LegacyStrings.jl:
Run Pkg.add(“LegacyStrings”) to install LegacyStrings on Julia v0.5-;
Then do using LegacyStrings to get wstring.

in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in macro expansion; at ./none:2 [inlined]
in anonymous at ./:?
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in process_options(::Base.JLOptions) at ./client.jl:242
in _start() at ./client.jl:321
in _start() at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
while loading /Users/gsmith/.julia/v0.5/PyCall/src/…/deps/deps.jl, in expression starting on line 3
while loading /Users/gsmith/.julia/v0.5/PyCall/src/PyCall.jl, in expression starting on line 37
ERROR: LoadError: Failed to precompile PyCall to /Users/gsmith/.julia/lib/v0.5/PyCall.ji.
in compilecache(::String) at ./loading.jl:593
in require(::Symbol) at ./loading.jl:393
in require(::Symbol) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in macro expansion; at ./none:2 [inlined]
in anonymous at ./:?
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
in process_options(::Base.JLOptions) at ./client.jl:242
in _start() at ./client.jl:321
in _start() at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
while loading /Users/gsmith/.julia/v0.5/PyPlot/src/PyPlot.jl, in expression starting on line 5
ERROR: Failed to precompile PyPlot to /Users/gsmith/.julia/lib/v0.5/PyPlot.ji.
in compilecache(::String) at ./loading.jl:593
in require(::Symbol) at ./loading.jl:422
in require(::Symbol) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?

Running versioninfo() gives me

Julia Version 0.5.2
Commit f4c6c9d4bb (2017-05-06 16:34 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core™ i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

I have tried installing Julia 4.7 and everything works just fine! However, I would like to use the latest Julia because ultimately I wish to work in the Juno environment in Atom and this doesn’t seem backwards compatible to older versions of Julia.

Thanks for the help

The version of PyPlot that you have is pretty ancient, so I’m not surprised to see it failing on v0.5. But it’s weird to see that it isn’t updating. How did you install PyPlot?

One possibility is that you have another package installed which requires an extremely old PyPlot version. What does Pkg.installed() show?

(Note that, as explained in the PyCall README, PyCall on Mac will install its own miniconda environment by default, via Conda.jl, so this isn’t necessary or even helpful. It won’t hurt you, but a new PyCall install will default to simply ignoring your Anaconda install unless you do ENV["PYTHON"]="python" before doing Pkg.add for the first time or in a subsequent Pkg.build("PyCall"). Once you’ve told PyCall what Python you want it to use, you don’t need to set this environment variable again.)

From the fact that you have an ancient version of PyPlot, I’m guessing that you were messing around with your package versions at some point. If you are new to Julia and you don’t have anything important installed, it might be easiest to just start over. rm -rf ~/.julia and then Pkg.add("PyPlot").

2 Likes

Thanks for the help!

Deleting the ~/.julia folder worked a treat. Everything is working now.

I had tried uninstalling and reinstalling Julia a couple of times. I guess that using appcleaner wasn’t removing that directory, so whatever I messed up on my first install wasn’t being cleared.

@rdeits: I had installed Julia with the official installer from julialang.org I must have done something wrong on the first install and then because the ~/.julia folder is persistent I couldn’t undo it easily.

I’m happy for this thread to be closed now