Hi,
I used dash and python to make an interactive dashboard for data analyses.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
The result is showed under http://127.0.0.1:8050/ whilst the code in spyder is running.
Is there any possibility to make an standalone executable file for windows so that one can use it locally without any knowledge in python or dash?
Simply, the user clicks just on the file and it runs locally.
Hi @nima,
That’s a good question, it is a problem I will be trying to solve in a few days to also ship a prototype of my dashboard done with Dash.
The first thing coming to my minds is for you to take a look at Pyinstaller. Its purpose is exactly that, bundling python projects into executables. You will then only have to open a browser and go to localhost:8050. This might even be feasible through code, with a bit of research…
Let me know how it goes for you if you try that way!
I went this route for a prototype and was able to get a standalone executable working. I was running into issues with the files in the assets folder. A work-around I found was to manually tell pyinstaller to include them in a folder called “assets” in the build. You can do this by using an --add-data command for each item in the assets.
@DandsomeHan I have the same issue as you with including the assets, but your solution doesn’t work for --onefile option?
I can read the working directory of the exe file into a string in the python code and pass it to assets_url_path(), but somehow dash doesn’t pick up the asset files from there.
I also tried to follow this guide, but unfortunately I get an error about the options = options in the setup.py.
Is there any chance you could help me with a step by step guide what you did to achieve a working exe?
Hi, I will try later to send you a Step by Step. For now, I share you and example of what I did, and It works.
I remember I had some problems with some files:
–> .dll from windows not found: The solution was to look for the file and incorporate it to the package.
-Question: why not to deploy it? I found it so much easier, and if you use heroku its free.
Also remember every time you want to make an improve, you will have to remake que .exe file.
@luquezsantiago It works! Or atleast, no errors compiling anymore. And when I click the .exe I don’t have any errors anymore. I needed to create a separate virtual environment. I think some packages might have conflicted with each other in my main environment.
However when I click the .exe file now, nothing really happens.
Separately my codes works. I think it might be because I import csv files. Do you maybe know what the correct way is of doing this? Do I need to add something to the setup.py?
Just to be clear, the requirements.txt needs to include all the different packages that are included in the dashboard app right? Is this required in order to make it run correctly?
It crashes when I add import pandas as pd in my script, so it should be something related with the packages.
I thought this shouldnt be a problem since I add ’pandas’ to the ’includes’ part of the options[’build_exe’]
EDIT: I think it might crash due to dll’s not begin included. Do you @luquezsantiago by any chance know which dll’s you included?
I’m facing the issue using auto-py-to-exe compile to .exe and also pyinstaller, i have tried both options single file and single directory with and without console. I’m not able to have the web app run on port 80 like i do in spyder IDE. Is there any trick with the webserver maybe ?? to my understanding the development web server of dash is able to run through the virtual environment, but is not the same running on bare OS (windows). Anyone with experience on this ?