PyPlot install on OSX


#1

Dear,
I’m having trouble installing PyPlot on OSX Mojave. This is Julia 1.1.0. Whenever I install PyPlot on a fresh Julia, it fails to plot anything from the REPL, no backend is used, an error is throwers to the screen and Julia crashes and quits.
The only solution is to install IJulia, load PyPlot from there and plot something. Then it also works on the REPL… This also happened to me with Julia 1.0.3. A friend of mine also found this issue…
Hope it can be solved soon.
Best,
Ferran.


#2

Do you have multiple Julia executables? What is the content of the file ~/.local/share/jupyter/kernels/julia-1.0/kernel.json and what is the output of Julia code Base.julia_cmd()?

It also is easier to find out the cause if you paste the whole error here.


#3

Hi,
sorry for the delay in the reply… Yes I have several julia installs: 0.5, 0.6.4, 0.7 up to 1.1. The file you mention is missing, I can dive to

~/.local/share/

but the only thing there is a file

recently-used.xbel

and nothing else. The contents of Base.julia-cmd() is

`/Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia -Cnative -J/Applications/Julia-1.1.app/Contents/Resources/julia/lib/julia/sys.dylib -g1`

I can not post the exact error thrown because after installing IJulia, the error solved itself. I can try to erase everything and start to install again to repeat the issue, though.
Best,
Ferran.


#4

OK I tried in my second Mac (an iMac) with the same result. What I get when trying using PyPlot from the REPL after a fresh new install oj Julia-1.1 is:

julia> plot(rand(1000),rand(1000))
2019-01-26 10:57:02.491 julia[33945:79942] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fb4c11233e0
2019-01-26 10:57:02.491 julia[33945:79942] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fb4c11233e0'
*** First throw call stack:
(
)
libc++abi.dylib: terminating with uncaught exception of type NSException

signal (6): Abort trap: 6
in expression starting at no file:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 15552862 (Pool: 15550194; Big: 2668); GC: 33
Abort trap: 6

…and that’s the end of the story :frowning:
Thanks a lot,
Ferran.


#5

…and once again, installing IJulia solves the problem on the REPL.


#6

It’s sometimes useful to browse through the issues on github, since others may have had the same problem. And sometimes there’s a solution, too.


#7

Sorry, it was for Linux. In macOS, it looks like it’s ~/Library/Jupyter/kernels/julia-1.0/kernel.json.

See: https://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html#data-files

This is the very puzzling part. My guess is that Python executable you use is from anaconda (i.e., using PyCall; PyCall.pyprogramname prints a path inside a conda environment) and then installing IJulia triggers installation of some conda packages including some matplotlib backend that is happened to work on macOS.

If that’s the case and if you are curious, I think running Conda.runconda(`list`) while you are having the error and also after installing IJulia fixes the issue may give you some hints.