Segmentation fault: 11 python after upgrading to OS Big Sur

Viewed 12784

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.

6 Answers

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

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!

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

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!

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

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.

Related