JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

Pyplot crashed Julia #441

Closed liuyoufang closed 5 years ago

liuyoufang commented 5 years ago

Hi All,,

I installed the new version of Julia and decided to see all the ruction is working or not.

But I got an error message:

julia> using PyPlot, SeisProcessing julia> subplot(131) 2019-05-12 13:47:02.245 julia[656:42779] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fb32d81bd40 2019-05-12 13:47:02.245 julia[656:42779] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fb32d81bd40' 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: 24100174 (Pool: 24095463; Big: 4711); GC: 50

I searched for a few solutions and tried to change the backend to TK. It does not work. And then I tried qt but it seems like the current Python I have does not have this Function. Anyone would shine some lights on it??

Cheers

stevengj commented 5 years ago

This is #410 — tkagg is broken (upstream bug) on MacOS, and you need to use a non-tk backend.

Are you using the Conda Python? (What is PyPlot.PyCall.python?) Conda can automatically install the qt backend for you.

liuyoufang commented 5 years ago

Hi Stevengj,

I am not using Conda Python.

OS X

On MacOS, you should either install XQuartz for MacOS 10.9 or later or install the Anaconda Python distribution in order to get a fully functional PyPlot.

MacOS 10.9 comes with Python and Matplotlib, but this version of Matplotlib defaults to with the Cocoa GUI backend, which is not supported by PyPlot. It also has a Tk backend, which is supported, but the Tk backend does not work unless you install XQuartz.

Alternatively, you can install the Anaconda Python distribution (which also includes ipython and other IJulia dependencies).

I think you are talking two methods that was mentioned above: either using Conda Python or using install XQUARTZ. I have installed XQUARTZ before so I do not use condo Python. But somehow it is still not working for me.

Thanks,

liuyoufang commented 5 years ago

This is #410 — tkagg is broken (upstream bug) on MacOS, and you need to use a non-tk backend.

Are you using the Conda Python? (What is PyPlot.PyCall.python?) Conda can automatically install the qt backend for you.

I am not using Conda Python.

OS X

On MacOS, you should either install XQuartz for MacOS 10.9 or later or install the Anaconda Python distribution in order to get a fully functional PyPlot.

MacOS 10.9 comes with Python and Matplotlib, but this version of Matplotlib defaults to with the Cocoa GUI backend, which is not supported by PyPlot. It also has a Tk backend, which is supported, but the Tk backend does not work unless you install XQuartz.

Alternatively, you can install the Anaconda Python distribution (which also includes ipython and other IJulia dependencies).

I think you are talking two methods that was mentioned above: either using Conda Python or using install XQUARTZ. I have installed XQUARTZ before so I do not use condo Python. But somehow it is still not working for me.

Thanks

liuyoufang commented 5 years ago

@stevengj I tried to change the backend in the matplotlibrc file from Agg to TkAgg....still not working

liuyoufang commented 5 years ago

@stevengj this is the value for the PyPlot.PyCall.python: "/Users/youfangliu/.julia/conda/3/bin/python"

liuyoufang commented 5 years ago

@stevengj Problem is solved for now. I have to manually install PyQt4 and change the backend to qt5agg in the matplotlibrc file at the location of .julia/conda/3/lib/python3.7/site-packages/matplotlib/mpl-data

stevengj commented 5 years ago

Was the backend manually set to tkagg before?

PyPlot should pick the qt backend by default if pyqt is installed. And if you are using the Conda Python (which you are, according to PyPlot.PyCall.python), then it should automatically install pyqt for you if that is set as the backend.

liuyoufang commented 5 years ago

@stevengj Nope, it was set up as egg instead of tkagg. The strange thing about it is that I used the installation that recommended by Julia to install the PyPlot, but it seems like it does not get the PyQt in correctly.

stevengj commented 5 years ago

Do you have a different backend specified in your matplotlibrc?

liuyoufang commented 5 years ago

I think that is the problem

On Wed, May 15, 2019 at 6:14 PM Steven G. Johnson notifications@github.com wrote:

Do you have a different backend specified in your matplotlibrc?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaPy/PyPlot.jl/issues/441?email_source=notifications&email_token=AMBQWNUWAS5FSSCV63776LTPVSKODA5CNFSM4HMLDFA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVQGVJY#issuecomment-492858023, or mute the thread https://github.com/notifications/unsubscribe-auth/AMBQWNVOEA777K4WK5WNY5TPVSKODANCNFSM4HMLDFAQ .