How to install tkinter

My app works fine on localhost but fails when deploying.

How do I install tkinter while deploying my streamlit app?

I know Iโ€™m supposed to keep in a requirements.txt file, but tkinter is part of python.

I tried using libtk8.6 as per this thread but got this error:

ERROR: Could not find a version that satisfies the requirement libtk8.6 (from versions: none)
ERROR: No matching distribution found for libtk8.6

Please help i"m so close to deploying my app

I donโ€™t know what you have in mind, but Tk will basically not work as long as streamlit is running on any hosted environment.

Basically, I have this given code which allows user to select a folder for embeddings. Objective is to read the file path so I can use it later on:

        # Set up tkinter
        root = tk.Tk()
        root.withdraw()

        # Make folder picker dialog appear on top of other windows
        # root.wm_attributes('-topmost', 1)

        # Folder picker button
        # st.title('Folder Picker')
        st.write('Please select a folder which will be used to save embeddings:')
        clicked = st.button('Folder Picker',type = "secondary")

        # User clicked on Folder Picker button
        if clicked:
            chroma_file_path = st.text_input('Selected folder:', filedialog.askdirectory(master=root))
            st.session_state['chroma_file_path'] = chroma_file_path

Any other viable alternative you recommend?

I donโ€™t know what you are trying to achieve, but this will probably not work, because you donโ€™t have access to the clients file system, as soon as streamlit is hosted.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.