I’m using Julia 1.10.3 with PyPlot (matplotlib 3.8.4)…
using PyPlot
loglog([0.001,0.1,1,10],[1e4,3e3,2e2,1e1],“o-”)
… I save this figure using the Save button in the figure window, this works. Then I close the window and display a new figure:
loglog([0.001,0.1,1,10],[1e4,3e3,2e2,1e1],“o-”)
… When I press the Save button in this new figure window, Julia crashes:
[4966] signal (10.1): Bus error: 10
in expression starting at none:0
lookUpImpOrNilTryCache at /usr/lib/libobjc.A.dylib (unknown line)
Allocations: 5144613 (Pool: 5140625; Big: 3988); GC: 7
Bus error: 10
In general, Julia with PyPlot crashes at the second attempt to save a figure. Does anybody know this problem and how to resolve it?
@ufechner7: Thanks for looking into this!
The problem with crashes of julia at a second attempt to save a figure are not new, I had the same problem with julia 1.9.
Also, when I load Metal and PyPlot in one line:
using Metal, PyPlot
julia crashes. When I load one after the other:
using PyPlot
using Metal
I can load both packages and julia does not crash.
Here’s the info you ask for:
I often use pyplot.jl on apple m2 with python 3.11.1 and matplotlib 3.6.2. Might help to know if you can save two figures consecutively when using matplotlib natively from python – make sure it’s not an issue on the python side.
Would also be good to see if it is a backend problem. Check the value of PyPlot.backend to see what backend you are using, and make sure you are using the same backend in Python (by setting the MPLBACKEND environment variable), or try switching to a different backend.
You can also try saving figures with savefig("foo.png") or savefig("bar.pdf"), for example, rather than using the GUI.