Search code examples
python-3.xsshqt5catxcb

How to deal with "QXcbConnection" error message when running a python script in a local machine on a remote desktop if plotting is part of the output?


I am trying to run a python script written in my local machine on a remote desktop using the following command line on terminal:

cat myscript.py | ssh username@machinename.departmentname.universityname.edu python

Python 3 under Anacanoda3 is installed on both local and remote machines. Here is the error message in the middle of the run while trying to display the plot:

QXcbConnection: Could not connect to display

What could be the reason and how to fix it? There were some other posts related to the same error message but for different reasons/usages.


Solution

  • You must use the -X parameter to activate window sharing.

    cat myscript.py | ssh -X username@machinename.departmentname.universityname.edu python