15

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 6

34

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
Sign up to request clarification or add additional context in comments.

Comments

4

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!

Comments

0

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

6 Comments

The problem is, is many of my other modules that I need(not shown) are not supported beyond 3.7.6, so it would be ideal if I didn't have to upgrade my latest python. The program was working on the same python version before the latest Mac update as well.
Do you think that you there is a compatibility setting on MacOS like how you can run exe files and programs in "compatabilaty mode" in windows 10?
I have no idea honestly. Probably not. I still do not know what's causing the issue
Also, a lot of the modules aren't compatible for 3.9, so upgrading is not ideal
I really don't know. I don't know much about mac-OS, but I know how it feels when something just doesn't work. I hope someone comes around and figures this out.
|
0

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!

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.