Segmentation fault: 11 python after upgrading to OS Big Sur

Question:

Yesterday, my program was working perfectly fine. However, today it stopped working. I think that it may have something to do with the latest Mac OS update, as I had just installed it today. My testing code is shown below

import matplotlib.pyplot as plt
import numpy as np
print("ehllow")
zeroes = np.zeros((10,10))
plt.imshow(zeroes)
plt.show()

Everything is going fine until I get to plt.show(). I had tried removing it, and the program ran smoothly, but once I added it back in I got the error

Segmentation fault: 11

and then it shows a python crash screenenter image description here

I have python version 3.7.6 64 bit for Mac.

Asked By: Dylan Ong

||

Answers:

Have you tried uninstalling it and reinstalling the latest python update and restarting you PC/Laptop?

Answered By: A-Yamout

Ok. Just for anyone wondering

Just uninstalling and reinstalling the packages that were giving the error worked for me

pip uninstall matplotlib
pip install matplotlib
Answered By: Dylan Ong

I had the same issue – a Python program that was working fine before updating to Big Sur, and crashing with:

Segmentation fault: 11

after updating.

As previous responses have advised, just uninstalling and reinstalling the offending Python libraries fixed the problem. For me, that meant matplotlib:

pip uninstall matplotlib 
pip install matplotlib 

Thank you!

Answered By: sashab

I also had the same issue:
Segmentation fault: 11

I guess, it is because of the statement line:
plt.show()

As stated above, uninstallation and reinstallation of matplotlib worked for me.
Thank you!

Answered By: pblamichha42

Reinstalling is the best option but you can also use:

import matplotlib as mpl
mpl.use('MacOSX')
import numpy as np
import matplotlib.pyplot as plt
Answered By: Raoul HATTERER

i had to drop my dpi from 400 to 50 on the OSX machine. none of these other approaches worked. fwiw, my update was to Catalina, not Big Sur.

Answered By: user108569

I have exactly the same issue. Segmentation fault: 11 uninstalling and reinstalling matplotlib did not work. I am using Python 2, because I have a lot of legacy code, and some of it won’t work in Python 3.

I tried specifying the MacOSX and TkAgg backends, but neither of those worked. So, I’m stuck. And I’m now trying to revert the operating system without success.

Answered By: DVC
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.