Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation fault: 11 python after upgrading to OS Big Sur

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.

like image 340
Dylan Ong Avatar asked Nov 15 '20 04:11

Dylan Ong


People also ask

What causes segmentation fault 11?

1) Segmentation Fault (also known as SIGSEGV and is usually signal 11) occur when the program tries to write/read outside the memory allocated for it or when writing memory which can only be read.In other words when the program tries to access the memory to which it doesn't have access to.

What is segmentation fault 11 python?

Segmentation fault 11 Python Segmentation fault 11 is usually caused by memory allocation issues, and if you're having this problem, be sure to try some of the solutions mentioned above. Related articles. PS Store browser not supported error [Quick fix] The code execution cannot proceed because DLL was not found.

What causes a segfault?

Overview. A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core . Segfaults are caused by a program trying to read or write an illegal memory location.

What causes a python segmentation fault?

Tip: A segmentation fault (also known as segfault) is a common condition that causes programs to crash; A segmentation fault is typically caused by a program trying to read from or write to an illegal memory location, that is, part of the memory to which the program is not supposed to have access.


2 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
like image 76
Dylan Ong Avatar answered Oct 12 '22 17:10

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!

like image 4
sashab Avatar answered Oct 12 '22 17:10

sashab