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.

Dylan Ong
  • 786
  • 2
  • 6
  • 14

6 Answers6

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
Dylan Ong
  • 786
  • 2
  • 6
  • 14
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!

sashab
  • 41
  • 2
0

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

A-Yamout
  • 9
  • 1
  • 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. – Dylan Ong Nov 15 '20 at 04:12
  • 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? – A-Yamout Nov 15 '20 at 04:19
  • I have no idea honestly. Probably not. I still do not know what's causing the issue – Dylan Ong Nov 15 '20 at 04:21
  • Also, a lot of the modules aren't compatible for 3.9, so upgrading is not ideal – Dylan Ong Nov 15 '20 at 04:22
  • 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. – A-Yamout Nov 15 '20 at 04:27
  • No Problem @green142f – A-Yamout Nov 15 '20 at 04:36
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!

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
Raoul HATTERER
  • 522
  • 5
  • 5
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.

user108569
  • 450
  • 5
  • 8