Creating an EXE from a Streamlit app using cx_Freeze on obfuscated scripts by pyarmor #2406
Replies: 2 comments 1 reply
-
|
When you try to freeze an obfuscated Python script, freeze is unable to find your script's dependencies, only pyarmor_runtime. The way I solved this was by adding an extra script for freezing, which only imports the dependencies your code needs (you can try doing this by copying and including all the imports you make in the plain script). Declare it along with setup.py to be freezing together. After build, you could delete it; it will serve so that ex_freeze can track its dependencies. |
Beta Was this translation helpful? Give feedback.
-
|
@Waschbrettwade could you please share the steps you took to make an executable for streamlit? I can't get a simple "hello world" streamlit application converted into an EXE. The moment I run any of the following commands, the command prompt gets stuck after printing a few lines of progress main.py has just 2 lines: Using python 3.13, streamlit 1.51, cxfreeze 8.4.1, After a few minutes of no change, when I cancel the run, I get the following error which makes it seem like the system is just waiting for something. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I have successfully turned my dummy Streamlit app into an EXE using cx_Freeze. However, I also want to protect my code. That's why I also obfuscate my scripts using pyarmor. Now, whether I first obfuscate my scripts and then create the exe, or the other way around, something doesn't quite work. I get the EXE to correctly execute at first. But when I press any button in the Streamlit app, I get
When using obfuscated scripts without cx_Freeze, there is no problem. Does anyone have an idea what's causing this and how to fix this? Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions