Tk initialization failed: no display name and no $DISPLAY environment variable

I am trying to invoke the tool on Centos server from the Ubantu terminal.I am getting the following error.

<strong>Tk initialization failed: no display name and no $DISPLAY environment variable.</strong>

Please Help me with this.Thanks in advance.


Connect to your CentOS machine with ssh -Y which (per man ssh)

Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.

That will allow your Tk process to connect to X11 on your Ubuntu machine.


I work on Ubuntu. I had the same problem while using gitk on remote machines. So I tried following

ssh @ip and ran gitk& got the "no display name and no $DISPLAY environment variable." error

ssh -X @ip and ran gitk& it worked! ssh -Y @ip and ran gitk& it worked!

Thanks for the solution. @Elliott Frisch


  • Dual RC522 on Orange PI
  • How can I run a macro as a workbook opens for the first time only?
  • SSL error RemoteCertificateNameMismatch
  • Securing web server against MITM attack in Safari
  • Alternatives to Coldfusion Report Builder
  • How to install python-devel for 2.7 version after upgrade to python 2.7 on CentOS
  • Open file with Windows' native program within C++ code
  • Using JNA to Get NSWindow from JComponent on mac
  • Redisplay results list on AutoCompleteExtender through javascript
  • EJB @Schedule issue
  • ant copy copying order
  • Why “propdp” code snippet doesn't use the nameof operator for the name of the registered proper
  • `docker cp` doesn't copy file into container
  • missing pie chart and other elements when display serenity report from jenkins
  • How to check disabled jobs with Jenkins server?
  • Python Paramiko send CTRL+C to an ssh shell
  • MongoDB GeoJSON “Can't extract geo keys from object, malformed geometry?” when inserting type P
  • GeoTrust SSL certificate on Android not trusted
  • CORS with socket.io
  • How to skip require in ruby?
  • Saving image to sd with current date and time in name doesn't work
  • Dynamically switching connect in Modelica
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • Check for zero lines output from command over SSH
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Redux Form - Not able to type anything in input
  • ADO and msqli connections very slow
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Yii2: Config params vs. const/define
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • javaw.exe and eclipse startup problems
  • Weird JavaScript statement, what does it mean?
  • How do you troubleshoot character encoding problems?
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • R: gsub and capture
  • 0x202A in filename: Why?
  • How to format a variable of double type
  • Benchmarking RAM performance - UWP and C#
  • How to Embed XSL into XML
  • Net Present Value in Excel for Grouped Recurring CF