Tag Archives: Bug—-QXcbConnection: Could not connect to display Aborted (core dumped)

Bug—-QXcbConnection: Could not connect to display Aborted (core dumped)

Question:

 1 fenglei@gpu01:~$ ipython
 2 Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:53:06)
 3 Type "copyright", "credits" or "license" for more information.
 4 
 5 IPython 5.1.0 -- An enhanced Interactive Python.
 6 ?        -> Introduction and overview of IPython's features.
 7 %quickref -> Quick reference.
 8 help      -> Python's own help system.
 9 object?  -> Details about 'object', use 'object??' for extra details.
10 
11 In [1]: import matplotlib.pyplot as plt
12 
13 In [2]: QXcbConnection: Could not connect to display
14 Aborted (core dumped)

Solution:

 1 fenglei@gpu01:~$ ipython
 2 Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul  2 2016, 17:53:06)
 3 Type "copyright", "credits" or "license" for more information.
 4 
 5 IPython 5.1.0 -- An enhanced Interactive Python.
 6 ?        -> Introduction and overview of IPython's features.
 7 %quickref -> Quick reference.
 8 help      -> Python's own help system.
 9 object?  -> Details about 'object', use 'object??' for extra details.
10 
11 In [1]: import os
12 
13 In [2]: os.environ['QT_QPA_PLATFORM']='offscreen'
14 
15 In [3]: import matplotlib.pyplot as plt