I am trying to run a python script to generate heatmap and clustering dendrogram. But I got an error message saying :

import: unable to open X server @ error/import.c/ImportImageCommand/361

I am a new to both linux and python. So I cannot make out utterly why the error happened. Dose anyone know how to solve this problem?

My OS is linux fedora.


  • Can you tell a little bit more ? Python version, which part of your code generates that error ? etc...
    – Vinz
    Nov 4, 2015 at 10:46

1 Answer 1


Your script is being interpreted by a shell instead of python. The shell attempts to execute the X import command and that external /usr/bin/export command prints the error.

Make sure you have

#!/usr/bin/env python

at the top of each python executable script (not necessary for imported libraries). This causes the script to be interpreted by python.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .