I failed in stalling, as --user, tkinter

Maybe, is that action impossible, requiring gcc?

Best, Pietro

Tkinter requires a screen to draw on. Since we don't have that, it won't work. At some point in the far future, we may be able to provide the necessary drawing surface and deliver it across the web, but at the moment, it won't work.

Surely implementing gifsockets would be fairly trivial


Great, I'll try.

terna, I think rcs1000 was being facetious. The comment was to suggest that we should use gifsockets to provide a desktop that tkinter could use.

Thanks glenn; anyway rcs1000 gave me a good idea; generating an animation, I can send it to a different http address, were we could see the graphic results; as an example, I'll try to do something as at

So, the added value of non understood jokes can be positive ...

That's excellent. I'd love to hear how that goes.

Does Tkinter still not work?

Have you given much thought to creating your GUI in HTML? It's not hard, and if you're preparing animation, learning about the canvas and perhaps processing.js might go a long way. Tkinter and I go way back, but it's investment in a very old technology at this point.


Hey, even if we don't have a screen, then we could at least have the tk subsystem which allows to run our code window-less. We do that by calling tkinter.Tcl instead of tkinter.Tk. All we need is to have the python*-tkinter package installed.

You can run tclsh in a bash shell. I find it hard to imagine a usecase for tkinter without tk.

Just to take up the challenge, you could use xvfb to create a virtual frame buffer, draw things on it with Tk, and then use screen shots to save your graphics. :-)

(Of course, there are a lot easier ways to create graphics. I'm just pointing out an out-of-the-box possibility...)

Also - it is possible to send graphical output to a remote X display -- not sure how I'd do that with PA, maybe one could use an SSH tunnel. I've give that about 0.01 second of consideration, but who knows?


Is there a workaround running code with a dependency on _tkinter?

you could try downloading and compiling the tk libraries in your home folder?

incidentally, for anyone else that comes across this forum thread, if the reason you're trying to use tkinter is because it's required by matplotlib, you can tell matplotlib to use a different "backend", and that often fixes the error:


example here:

And here's our general help page on tkinter

Hello. I added to the code string

import matplotlib
import matplotlib.pyplot as plt

but all the same error:

2018-06-07 10:13:43,317: File "/usr/lib/python3.6/tkinter/", line 39, in <module> 2018-06-07 10:13:43,317: raise ImportError(str(msg) + ', please install the python3-tk package')

Did you put that at the top of the file? I think it needs to be the very first code that's run, as otherwise other code can interfere with it.

Just thought I'd cross post this for the googlers out there like me. I could not get:

import matplotlib
import matplotlib.pyplot as plt

to work for me at all - however, making a file called matplotlibrc containing

backend      : Agg

in the home/me/.config/matplotlib directory seems to have fixed it.