question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QXcbConnection: Could not connect to display

See original GitHub issue

When I create a completely fresh conda envirnoment:

conda create --name test ipython matplotlib

and then try to import matplotlib.pyplot from within ipython, I get the following:

In [1]: import matplotlib.pyplot

In [2]: QXcbConnection: Could not connect to display
Aborted

There is no problem when I run the same in the vanilla python shell. Happens for both py2.7.13 (ipython 5.3.0) and py3.6.1 (ipython 6.0.0).

I don’t know whether this is an ipython bug or a conda bug, so I raised an issue first with anaconda, but I wanted to note it here too.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:32 (14 by maintainers)

github_iconTop GitHub Comments

101reactions
wmaynercommented, Sep 8, 2017

There’s a solution using environment variables available here:

Setting export QT_QPA_PLATFORM='offscreen' in my .bash_profile worked for me.

22reactions
timothydmortoncommented, Sep 1, 2017

@russelljjarvis it’s a minor annoyance, but if the first command you run when you start up ipython is import matplotlib; matplotlib.use('agg') then ipython should work for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

qt.qpa.screen: QXcbConnection: Could not connect to display ...
An application that was working fine on MacOS Mojave 10.14.6 was transferred to Ubuntu20.10 running on an i5 pc.
Read more >
Solved - QXcbConnection could not connect to display ...
if you have error like qxcbconnection: could not connect to display wkhtmltopdf ubuntu. When i installed wkhtmltopdf on my ubuntu server and i ......
Read more >
Can't use vscode remote connection with cv2.imshow() : qt ...
I'm using vscode to connect to a server and I want to display an image with cv2.imshow() from openCV, but I get the...
Read more >
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Hi, I am trying to run this software. I am using the dockerfile to build an image but I cannot run it with...
Read more >
How To Fix Qxcbconnection: Could Not Connect To Display?
QXcbConnection: Could not connect to display · step 1 : Install xvfb: · step 2 : Generate PDF File using xvfb wkhtmltopdf: ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found