PyCharm debug segmentation fault (signal 11)

11,989

Solution 1

I had the same error message. I deleted anaconda and installed miniconda instead and reinstalled pycharm. The exit code 139 came both when I was running a python console as well as the debugging console.

Now when I import matplotlib, I still get the messages:

Backend Qt4Agg is interactive backend. Turning interactive mode on.

GLib-GIO-Message: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications.

I guess thats not ideal but I am not getting an exit code and everything seems to work. It is a solution, but there must be a more robust way.

Solution 2

A bit late but it might help some googler.

Qt can cause this Problem. PyCharm runs with --qt-support=auto by default. If you have python bindings for Qt4 and Qt5 installed the auto function might not choose the correct version of Qt. Try to set the correct Qt bindings in PyCharm Settings (Build, Ex... -> Python Debugger - PyQt Compatible)

Setting from Auto to PyQt4 worked for me in conda environment, without removing anything.

Solution 3

I managed to get rid of the segfault and code 139, by unticking the Qt box in PyCharm Settings (Build, Ex... -> Python Debugger). My usage scenario: running some code with a remote interpreter. Needed matplotlib just for some figure.

Solution 4

A quick and dirty work-around is to switch out the Qt backend for another one. For example, add this immediately after importing Matplotlib:

matplotlib.use('TkAgg')

You may want to use another one of the available backends.

If you have various modules with Matplotlib dependencies and you don't want to pollute your code, or if you're on a team, it would be better to change the backend in your matplotlibrc. You can find which matplotlibrc you're using with:

import matplotlib
print(matplotlib.matplotlib_fname())

Solution 5

Mine worked after I removed pyqt5 bindings.

sudo apt-get remove python3-pyqt5

Share:
11,989
user155322
Author by

user155322

Updated on June 03, 2022

Comments

  • user155322
    user155322 about 2 years

    In PyCharm (community edition 2016.2.3), using anaconda2 + ubuntu 14.04, import matplotlib causes a signal 11 error during the debug mode. There is no problem when executing the script in release mode.

    The python code:

    import matplotlib as pt
    

    The debug console:

    Connected to pydev debugger (build 162.1967.10) GLib-GIO-Message: Using the 'memory' GSettings backend. Your settings will not be saved or shared with other applications. Backend Qt4Agg is interactive backend. Turning interactive mode on.

    Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

  • Mr. T
    Mr. T almost 6 years
    This has already been provided as an answer: stackoverflow.com/a/51312698/8881141
  • James Paul Mason
    James Paul Mason over 5 years
    "some googler" here 😁. I notice that PySide2 is not in the list of options (though this is now the official Qt for Python). Do we have to wait for PyCharm to include it to use your solution or could there be a workaround?