My streamlit app run well localy (windows anaconda python 9.3.13 and is successfully deployed on heroku but failed to run online because of this error : File “/app/.heroku/python/lib/python3.9/tkinter/init.py”, line 37, in import _tkinter # If this fails your Python may not be configured for Tk
I read solution here and on stackoverflow and test them especially change python version, reinstall tkinter via anaconda, but il am on windows without wsl I don’t know how to install or reinstall tkinter with apt-get or brew …
On streamlit.share I have got the same issue and solve it with a packages.txt file with just this line libtk8.6, solution I had found on this forum… it works fine my app run on share.streamlit.io but I can share it because this service need to subscribe an account and it’s not possible for the people who I want to share the app…
On heroku, I try to add libtk8.6 in the runtime.txt file needed by heroku but it doesn’t work …
Thanks to help me … if somebody had the same issue.
In don’k know how, or even if, you can import tkinter in Heroku, but more often than not you should be fine just not importing it. What would you want to use tkinter when running in a headless server?
Thanks @Goyo for your reply. I don’t want to use tkinter, i have understood that import tkinter is adding by streamlit when using matplotlib or another datavisualisation library… As I have spent more time attempting to deploy the app than creating it, I have tried to run without this import of tkinter but my app doesn’t run anymore … the main purpose of this app is to visualize data so I need plotly seaborn or matplotlib…
Thanks again, I’ll had the same remark as yours on stackoverflow…
I wonder what makes you believe that. I am pretty sure streamlit does not need tkinter for anything, including matplotlib and plotly visualizations. It just makes no sense.
Unfortunately, “my app doesn’t run anymore” is not a very useful description of whatever is happening. Have a look at the guidelines for posting and help us to help you.
Thanks again @Goyo. I have disable lines of code which refer to tkinter commenting them out, and it works. My webapp is successfully deployed on heroku without error. Thanks again !
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.