Skip to content

Instantly share code, notes, and snippets.

@mvidaldp
Created August 16, 2019 11:31
Show Gist options
  • Save mvidaldp/f759dc42d5b9d5bc288b3031403ae57e to your computer and use it in GitHub Desktop.
Save mvidaldp/f759dc42d5b9d5bc288b3031403ae57e to your computer and use it in GitHub Desktop.
How to work with JupyterLab extensions (install/enable) userwise: working path and user config setting

You may have noticed that you cannot install JupyterLab extensions on a user level (no root) out of the box on Linux/Unix systems.

After reading and trying different suggestions I recommend the next steps:

1. Build your JupyterLab assets. Open your terminal and run:

JUPYTERLAB_DIR=.jupyter/lab jupyter-lab build

Set the path you want/need, notice that you can run 'jupyter lab' instead of 'jupyter-lab.

2. Now you are ready to launch JupyterLab specifying the working directory and work with extensions:

on GUI

JUPYTERLAB_DIR=.jupyter/lab jupyter-lab

on Terminal

JUPYTERLAB_DIR=.jupyter/lab jupyter labextension install extension_name

3. Make the directory variable permanent for your command line shell:

for Bash

echo "export JUPYTERLAB_DIR=~/.jupyter/lab" >> .bashrc

Now you can run JupyterLab from your terminal and list, install/uninstall, update, enable/disable, etc., extensions via GUI and also manage them with the extensions package manager:

jupyter labextension <install/uninstall/enable/disable/update> extension_name

If you want to launch JupyterLab without using the terminal with your set working directory you need to generate and edit your user config file.

4. On your terminal, run:

jupyter-lab --generate-config

5. Edit the generated user configuration file and uncomment the next line:

c.LabApp.app_dir = '/home/your_username/.jupyter/lab'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment