I am desperately trying to make tkinter work on my EC2 instance.
I just want to be able to execute this line in python:
from tkinter import *
After the previous answers I realized why it was not working so I made it work using an EC2 Ubuntu instance and doing the following:
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get update
sudo -E apt-get install -y ubuntu-desktop
sudo add-apt-repository ppa:freenx-team
sudo apt-get update
sudo aptitude install -y freenx
wget https://bugs.launchpad.net/freenxserver/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
tar -xvf nxsetup.tar.gz
sudo cp nxsetup /usr/lib/nx/nxsetup
sudo /usr/lib/nx/nxsetup --install
Then said no when asked for a password and did:
sudo vi /etc/ssh/sshd_config and set PasswordAuthentication to yes
sudo /etc/init.d/ssh restart
sudo passwd ubuntu
sudo apt-get install gnome-session-fallback
Once this was done I installed NX client on my local machine. All this thanks to this page
Connected to my new server where I was able to install python-tk like that:
sudo apt-get install python-tk
And now I can use tkinter on my instance :)
Tkinter requires a display. Unless you can somehow access a desktop on the AWS instance, you won't be able to load tkinter, much less use it.