Convert Dash to executable file (.exe)

hey so trying to make the hello world only and it’s not working when I run the scrip it works fine and I visit http://127.0.0.1:8050/ and there’s no problem however when I run the .exe it doesn’t work it opens the console and closes it right away.

1 Like

Hey there, could you solve it?
thanks

I’m having the same problem here. If I screenshot right before it closes I get this error…

  'app.py' is not recognized as an internal or external command, operable program or batch file.

Please check out my post for further information. It sounds like were in the same boat.

1 Like

I have the same problem. Have you found a solution to this problem?
Thank you

Thanks for Heroku suggestion, I managed to publish there previously.

But cx_Freeze in windows is throwing error as below.
File "C:\Applcn\env\lib\site-packages\pkg_resources\__init__.py", line 853, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'flask-compress' distribution was not found and is required by the application

Even I included flask_compress in build_exe_options.

Python 3.6.0
cx-Freeze==6.3
cx-Logging==2.2
Flask==1.1.2
Flask-Compress==1.8.0
waitress==1.4.4

I could not find related help in cx_Freeze issues/FAQ or flask issues. First time using this, please help in. :blush:

@ksh I came across the same issue when I upgraded from dash 1.6.1 to 1.7, before that I was running dash exe’s with no problem (Python 3.7.3 and all my cx-Freeze/Flask/Waitress versions are the same as you). I just downgraded back to dash 1.6.1 and the issue went away again. You can do this by running:

pip install dash==1.6.1

Hope that helps!

Hello, I am facing the same problem here! I searched everything ,I tried the answer from @Philippe (thank you by the way). The problem is in the Dash version, I am using the 1.17.0 and I can not downgrade because the oldest version is not allow you to have many inputs and outputs at callbacks. Does anybody found a solution for newer version?

im running into the same issue. Does anyone know how to fix it?

I’m facing the same issue using auto-py-to-exe compile to .exe, tried both options single file and single directory. I’m not able to have the web app run on port 80 like i do in spyder IDE. My concern is maybe the default web server of dash is not proper web server to run on OS.

Hey guys,
I was struggling a lot with this seemingly easy problem and managed to find an easy solution using pyinstaller. I wrote a quick tutorial in my github, hoping it might be useful for someone else:

How did --add-data worked for you?
I am missing a json file for trace_update, located in the Lib folder. I did this

pyinstaller --onedir --add-data “C:\Pycharm_Project\Plotly\Scripts\Lib\site-packages\trace_updater\package-info.json” ifs_dash6.py

throws an error

pyinstaller: error: argument --add-data: invalid add_data_or_binary value: ‘C:\Pycharm_Project\Plotly\Scripts\Lib\site-packages\trace_updater\package-info.json’

also how to add multiple files for command prompt

When using --add data you should specify also the destination folder for this file (usually just the module name). Look at pyinstaller documentation here:
https://pyinstaller.org/en/stable/usage.html

Hi Sharon,

I understood the significance of

;

and

.

while reading the documentation. Also found this

kivy - Pyinstaller adding data files - Stack Overflow.

I still failed getting it done right so I ended up manually copying the missing file into the ‘dist’ folder and it works now.

Thanks for your response.

Hello! I followed the steps described above but when I tried to run the exe I got this error:

Traceback (most recent call last):
  File "C:\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cx_Freeze\initscripts\__startup__.py", line 138, in run
    module_init.run(name + "__main__")
  File "C:\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\cx_Freeze\initscripts\console.py", line 16, in run
    exec(code, module_main.__dict__)  # pylint: disable=exec-used
  File "server.py", line 3, in <module>
ImportError: cannot import name 'server' from 'app' (C:\Local\Programs\tst\lib\library.zip\app.pyc)

Does anyone knows what could be happening?