Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm debug segmentation fault (signal 11)

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)

like image 772
user155322 Avatar asked Oct 23 '16 13:10

user155322


2 Answers

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())
like image 151
crypdick Avatar answered Oct 05 '22 05:10

crypdick


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.

like image 26
FranzMueller Avatar answered Oct 05 '22 05:10

FranzMueller