Skip to main content

Run LiberTEM via JupyterLab/JupyterHub

Project description

Run the LiberTEM GUI in JupyterLab / JupyterHub

See the LiberTEM docs for more details!

Requirements

  • Python 3.6+
  • Jupyter Notebook 6.0+
  • JupyterLab 2.1+
  • LiberTEM 0.8.0+ (currently requires unreleased changes only available in the master branch!)

LiberTEM

LiberTEM is an open source platform for high-throughput distributed processing of large-scale binary data sets and live data streams using a modified MapReduce programming model. The current focus is pixelated scanning transmission electron microscopy (STEM) and scanning electron beam diffraction data.

Install

  1. Clone this repo

    $ git clone https://github.com/LiberTEM/LiberTEM-jupyter-proxy

  2. Install dependencies and LiberTEM master:

    $ pip install -e .

    $ pip install -e "git+https://github.com/liberTEM/LiberTEM/#egg=libertem"

  3. enable jupyter-server-proxy extension

For Jupyter Classic, activate the jupyter-server-proxy extension:

jupyter serverextension enable --sys-prefix jupyter_server_proxy

For Jupyter Lab, install the @jupyterlab/server-proxy extension:

jupyter labextension install @jupyterlab/server-proxy
jupyter lab build
  1. Start jupyter-lab or jupyter-notebook

    $ jupyter-lab

or

$ jupyter notebook

Now LiberTEM should be available as an icon in JupyterLab, or in the "New" dropdown in the classical notebook interface / JupyterHub.

Deployment notes

When deploying behind a reverse proxy, make sure websocket requests are proxied for all URLs, not just for specifically matching ones. Otherwise, something like connecting to wss://<hostname>/user/<username>/libertem/events/ will fail with 400 bad request, as Upgrade: websocket is not supported.

If you want to customize the startup of LiberTEM, you can drop a JSON file into $PREFIX/etc/libertem_jupyter_proxy.json, with contents like this:

{"libertem_server_path": "/path/to/a/venv/bin/libertem-server"}

One use case is to install LiberTEM itself into a different Python environment than Jupyter, as in the example above. Another is to write a wrapper script to customize the environment setup, as in the example script libertem_jupyter_proxy/share/launch_juwels.sh

Without configuration, libertem-server is expected to be found in $PATH.

Try it (WIP)

Binder

Thanks

Mostly stolen from https://github.com/betatim/vscode-binder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

libertem_jupyter_proxy-0.1-py3-none-any.whl (107.0 kB view details)

Uploaded Python 3

File details

Details for the file libertem_jupyter_proxy-0.1-py3-none-any.whl.

File metadata

  • Download URL: libertem_jupyter_proxy-0.1-py3-none-any.whl
  • Upload date:
  • Size: 107.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for libertem_jupyter_proxy-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c549e253089f66877a8088d829d93a77fb66091883812fa5464c8a8232458102
MD5 e3a8f947e92653428314715884418d5a
BLAKE2b-256 6190dce26986e7536455f7032e25ec7bb4a94623709c19b2e88ee41e4e1138aa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page