Best way to create/distribute a stand alone app based on Jupyter Notebook/JupterLab?
Asked Answered
S

3

20

I've built a fairly complex graphical user interface for a data analysis pipeline that a neuroscience lab is using. I built it with Python in a Jupyter Notebook using ipywidgets and various interactive plotting libraries such as bokeh. It's basically just a GUI for an existing Python analysis package, but many researchers don't have any or sufficient programming skills to use it and hence need a GUI.

The problem is that it's a fairly involved setup process. You have to install anaconda, install a bunch of libraries, launch a Jupyter notebook server, etc. This installation process is not feasible for people with minimal tech skills.

How can I package and deliver my Jupyter Notebook app as close to a "download and double-click the installer" type of setup as possible? It needs to be easy for non-tech people. Does the new JupyterLab offer anything here? Could I package it as an Electron app some how?

Seafaring answered 18/3, 2018 at 7:52 Comment(2)
nteract (nteract.io) is no-go for those purpose? nteract puts significatnt amount to build integration around jupyter. If you could fit current code / pkg into those distribution, may worth than try to create something from scratch.Pirn
One option is to create a tarfile with conda package containing your entire environment; this tarfile can then be installed with conda install --offline <tarfile>. Note that any locally-compiled libraries (for example, with Cython) will not be relocatable, so this only works if you are using pure python + prepackaged libraries. see this discussion.Deirdredeism
G
6

Have you tried conda constructor?

  • It creates a double click + follow steps installer, which installs python, conda and specified conda packages.
  • Installing Jupyter this way also creates a start menu entry in windows to start the Jupyter server.
  • It also allows you to specify pre- and post-install batch scripts, that you can use for extra configuration.
  • It can create linux and osx installers as well.

For distribution and updates of apps (.ipynb files), I once used the startup scripts of the Jupyter server to check for newer versions in a github repo and pull the new versions of the files if there were any.

Also, for a friendlier user experience inside Jupyter, check appmode.

Glenine answered 10/4, 2019 at 5:16 Comment(3)
Would it be possible to add a start menu entry that launches Jupyter into a specific notebook?Seafaring
Yes, the tool used by conda to install the start menu item is menuinst. It uses a json that specifies the command that runs on click. You can modify this command (and make it open Jupyter on a directory or file) and reinstall the menu item using the python api of menuinst. All this can be done manually or be added to the post-install script of constructor. You can even add your own menu icon.Glenine
This seems to be the best option at this point. Ideally something like a standalone nteract app on a jupyter notebook would be best, but that doesn't seem to be do-able at this point.Seafaring
O
1

You might be able to use pyinstaller for it. If you can start your program by calling a simple python script.

pip install pyinstaller

pyinstaller --onefile your_script.py

If you execute this in a windows environment a windows exe file is created which contains all the dependencies. I am not sure what happens on a linux system. The exe file may become very large though.

You might run into problems if the script needs any temporary files etc. I am trying to figure that part out myself.

Outcross answered 6/2, 2020 at 23:0 Comment(0)
D
0

If you're OK with hosting it on a server, you can use Voilà, which supports ipywidgets: voila.readthedocs.io

Voilà allows you to convert a Jupyter Notebook into an interactive dashboard that allows you to share your work with others.

They also have some deployment instructions for various environments: voila.readthedocs.io/en/stable/deploy

Decentralization answered 27/4 at 11:31 Comment(1)
Related to this suggestion, there is also Voici in development. It is essentially Voila run with JupyterLite so that allows the Python handling code to be run inside the users browser so you don't need a server that serves active Python, just a static files hosting site or server. I note the OP mentioned using ipywidgets and bokeh and both of those work with the pyodide kernel that underlies JupyterLite.Xenomorphic

© 2022 - 2024 — McMap. All rights reserved.