Portable Streamlit with Python Portable

Hello,

My need is to put all the content (Python + App) on an usb key which can be used on demand on different computers. I tried using my Streamlit installation but of course when I put the Portable Python with Streamlit on an usb key, the streamlit.exe try to search like if it was on the previous installation.

Is it possible to use Streamlit with Python Portable on Windows without installation right ?

So for information, modifying the streamlit.exe changing the path of the python interpreter do the job. After you just have to go on the streamlit.exe directory with cmd and launch streamlit.exe run path_of_the_python_script.

I think an improvment could be to put this python path on a configuration file called by streamlit.exe. With that, Streamlit can become portable.

1 Like

Glad you were able to figure that out @cloud. This feels like one of those edge cases that if the community implemented it, we might consider merging a pull request, but itโ€™s probably not something weโ€™d work on ourselves. From my brief Google searching, it doesnโ€™t look like Python Portable is supported anymore?

Best,
Randy

@randyzwitch Iโ€™m using https://sourceforge.net/projects/portable-python/ which seems to be supported, not http://portablepython.com/.

I resolved it patching streamlit.exe but it is not a long term solution. Maybe Iโ€™ll try to automate it with pefile library.
Technically, if streamlit readed the python path in a file, it could resolve it and permit to use the same streamlit.exe for differents python interpreters. We could also just imagine the same like currently but just a system to overwrite this value with a config file.

1 Like

Hey @cloud, thanks for the proposed solution!
I have no experience in working with PE files. Could you give some guidance on how did you edit the python interpreter path inside Scripts/streamlit.exe ?

Iโ€™ve tried to dig a little on pefile library buy couldnโ€™t exactly understand where to find and how to edit the python interpreter path in the .exe file.

Thanks again!