_tkinter import failed during app deployment

Hi,

when trying to deploy my app I get the following error:

File “/usr/local/lib/python3.7/tkinter/init.py”, line 36, in

import _tkinter # If this fails your Python may not be configured for Tk

ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

my research resulted in python3-tk needs to be installed on the VM/container.
Using pip modules tk and/or Everything-Tkinter gave no success.
I guess that it is a core library which is not delivered via requirements.txt.

How to fix that?

thx

Replying to my own question:

/usr/lib64/libtk8.6.so is part of tk. So tk is needed on the cloud VM.
I see no possibility to influene the os packages inside the VM. How
to achieve that?

packages.txt

App dependencies - Streamlit Docs

I didn’t know
thanks Franky1 :+1:

which distro is behind the cloud image?
I’m not sure about some package names, e.g. I would like to install npm, nodejs also.

thx

Found it here: App dependencies - Streamlit Docs
apt-get

Hey I am trying to deploy an app that works ok on my windows machine and I am getting the same error. I need to put a requirements.txt next to my app.py file with something in it? I’m not sure how to do this and am confused how the app that works fine locally doesn’t on streamlit cloud…

Hi Ryan,
put a file packages.txt into the root of your app and insert a line libtk8.6
Into it. Afterwards restart the VM. This will do the trick.

1 Like

This worked! Thank you!