Skip to content

enable users to create standalone desktop Dash apps #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adrianoesch opened this issue Nov 15, 2017 · 23 comments
Closed

enable users to create standalone desktop Dash apps #158

adrianoesch opened this issue Nov 15, 2017 · 23 comments
Labels
feature something new P3 backlog

Comments

@adrianoesch
Copy link
Contributor

I think for a lot of cases people don't want to get stuff running on a server and it's too big a hassle for some to run it locally. So i was thinking, given the popularity of electron, whether it would be possible to create a standalone app that reads and publishes sth like dash-books. Guess this could be really powerful (kind of an alternative to tableau etc.). I might have a go at it if you can point me into the right direction.

@chriddyp
Copy link
Member

Hey @adrianoesch - Yeah, this is a great idea. The main difficulty in doing this is managing the cross-platform python installation and dependencies. Electron makes it easy by packing everything up, as far as I'm aware, there isn't a solution that makes this as easy in Python.

Now, if the user does have python installed, then I presume that some type of "dash-reader" could use that dist of python, create a virtual env, and automatically install dependencies, and then run the app.

Or, we could leave installing the dependencies entirely up to the user. A Dash Viewer App could just make Dash files "double-clickable" - double clicking on a dash app file (.py? or a new file extension like .dash?) would open run the app automatically using the configured version of python and open that app in an electron window. This is sort of like what nteract does with jupyter notebooks.

Another future to imagine is entirely standalone Dash apps that don't use any python callbacks - basic interactivity between components is defined through a JSON spec and entirely self-contained within an HTML file. These apps would be very easily distributable. See plotly/dash-renderer#7 for a POC

@adrianoesch
Copy link
Contributor Author

adrianoesch commented Nov 15, 2017

Thanks for your interest. I'll have a deeper look into you answer later. I found this in the meantime, looks promising.

@ned2
Copy link
Contributor

ned2 commented Nov 16, 2017

It's possible the BeeWare project could be useful. In particular, Briefcase, for packaging the app for multiple OS targets.

@chriddyp chriddyp changed the title Dash Book Reader Standalone App Creating Standalone Desktop Dash Apps Jun 8, 2018
@nicolaskruchten
Copy link
Contributor

@DavidRSeWell
Copy link

@adrianoesch Hey, curious if you were able to make any progress in this area? I am interested in doing the same thing. The flask desktop project you linked to a year ago looks promising although I dont know if it will play nicely with dash or not but I am going to give it a go.

@mungojam
Copy link
Contributor

mungojam commented Aug 4, 2018

@chriddyp

Electron makes it easy by packing everything up, as far as I'm aware, there isn't a solution that makes this as easy in Python.

pipenv environments seem to include all dependencies in the virtual environment folder including python itself. It would be a bit bulky, but I feel like it should be possible to use that to bundle all the python requirements.

@adrianoesch
Copy link
Contributor Author

adrianoesch commented Aug 4, 2018

@befeltingu have a look at pywebview (https://github.com/r0x0r/pywebview). i played around a bit with it, seems to be a good desktop solution for flask/dash integration but you still have to ship everything in binaries. but this should not be too difficult either... (check the post from nicolas further up)

@DavidRSeWell
Copy link

DavidRSeWell commented Aug 4, 2018

@adrianoesch Thanks for the link that looks promising I will have a look. I have been looking at (https://github.com/smoqadam/PyFladesk) myself. It opens your Flask app in a Qwebview instead of using your browser.

@cheak1974
Copy link

cheak1974 commented Nov 15, 2018

You could use Pywebview for a Cross platform Desktop App. It uses native Windows on every platform with a Web view inside and serves the App inside this Window.

https://github.com/r0x0r/pywebview/blob/master/README.md

Remi is using this as well to serve WebApps as Desktop Apps locally if you start the server with the standalone flag.

@kknckk
Copy link

kknckk commented Nov 26, 2018

@adrianoesch what was your final solution? PyFladesk? Everything worked fine?

@filusn
Copy link

filusn commented Nov 13, 2019

Hi guys! Since there is no answer from OP for a year, I can tell you that PyFladesk works like a charm for me. To use with dash you have to replace init_gui(app) with init_gui(app.server).
I still had a problem with packaging application to exe with cx_Freeze (the app crashed), but if you don't want to do this, it should work.

@luquezsantiago86
Copy link

Hi guys! Since there is no answer from OP for a year, I can tell you that PyFladesk works like a charm for me. To use with dash you have to replace init_gui(app) with init_gui(app.server).
I still had a problem with packaging application to exe with cx_Freeze (the app crashed), but if you don't want to do this, it should work.

Hi there, so if I want to use it in a computer with no python it is not working, isn´t it?

HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
* improve props typing

* bump version

* improve typing for dropdown values

* required props / nested props

* remove isRequired from column name (not confirmed yet)

* make column name required
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
* improve props typing

* bump version

* improve typing for dropdown values

* required props / nested props

* remove isRequired from column name (not confirmed yet)

* make column name required
@adamgreg
Copy link

adamgreg commented Nov 18, 2021

Hi, I wanted to be able to optionally run my Dash application with the look & feel of a native application (not necessarily frozen into an executable), and came across this thread.

I ended up implementing something for this using the native-web-app package to open the system web browser in its "web app" mode. It also shuts down the server, when the window is closed, exiting the application. It works well with Chrome and MS Edge on Windows, at least. I thought I'd share this gist here in case it helps anyone else searching for this:

https://gist.github.com/adamgreg/cc1abd2123cf820d9e71bf3afb5e63f5

@luquezsantiago86
Copy link

Hi, I wanted to be able to optionally run my Dash application with the look & feel of a native application (not necessarily frozen into an executable), and came across this thread.

I ended up implementing something for this using the native-web-app package to open the system web browser in its "web app" mode. It also shuts down the server, when the window is closed, exiting the application. It works well with Chrome and MS Edge on Windows, at least. I thought I'd share this gist here in case it helps anyone else searching for this:

https://gist.github.com/adamgreg/cc1abd2123cf820d9e71bf3afb5e63f5

Hi Adam, looks like a really smart workaround, thanks for sharing.

@LukeDev42
Copy link

@adamgreg Did you package that app into an executable?

@adamgreg
Copy link

adamgreg commented Apr 4, 2022

@LukeDev42 No, I just run it as a script. AFAIK there no reason it wouldn't be compatible with PyInstaller though. Let me know if you have any success!

@LukeDev42
Copy link

I used native-web-app to create and easy way to open my app, used pytinstaller to create an executable for the app. Worked flawlessly, didn't even need to pass any crazy options for pyinstaller. Now I'm gonna make an installer using Inno Setup then I can publish the tool.

@wcheek
Copy link

wcheek commented Aug 22, 2022

@LukeDev42 Could you go into a bit more detail of how you were able to create the executable using pyinstaller? What does your spec file look like? I have been running into some issue with bundling dependencies and other files.

My requirement is basically a standalone .exe that can be distributed and run without a local python installation.

@luquezsantiago86
Copy link

@LukeDev42 Could you go into a bit more detail of how you were able to create the executable using pyinstaller? What does your spec file look like? I have been running into some issue with bundling dependencies and other files.

My requirement is basically a standalone .exe that can be distributed and run without a local python installation.

This is old, and is using cx_Freeze, but maybe it helps you:

https://github.com/luquezsantiago86/Standalone_Exe_App.git

@LukeDev42
Copy link

@LukeDev42 Could you go into a bit more detail of how you were able to create the executable using pyinstaller? What does your spec file look like? I have been running into some issue with bundling dependencies and other files.

My requirement is basically a standalone .exe that can be distributed and run without a local python installation.

To be clear, I did not use the one exe argument. I created the directory and an installer for the user to use. The installer set up a file in their program folders and created a desktop shortcut for them.

@gvwilson
Copy link
Contributor

gvwilson commented Jun 3, 2024

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

@gvwilson gvwilson closed this as completed Jun 3, 2024
@Ivorforce
Copy link

I was recently able to build dash into a standalone using a combination of pywebview and Nuitka. Dash / Flask create a server, pywebview accesses it, and nuitka creates a standalone application (.app on macOS, .bin on Linux, .exe on Windows).

I've published my efforts into a GitHub template here: https://github.com/Ivorforce/Dash-Standalone-Boilerplate

@gvwilson gvwilson reopened this Jul 2, 2024
@gvwilson gvwilson self-assigned this Jul 2, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@enzofranzy
Copy link

Yeah you can do it pretty easily in Windows with pywebview and autopytoexe.

You can see an example here with a Flask server inside a Dash APP to show a live stream video + an explanatation how to make your .exe

https://github.com/enzofranzy/Dash---Stream-Video-pywebview/tree/main

@gvwilson gvwilson changed the title Creating Standalone Desktop Dash Apps enable users to create standalone desktop Dash apps Aug 13, 2024
@gvwilson gvwilson added feature something new P3 backlog labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests