Published on

Using pipenv's virtualenv as a kernel in JupyterHub

Authors
  • avatar
    Name
    tuxedocat
    Twitter

Run python -m ipykernel install --user --name=<kernel-name> in pipenv-enabled shell.

  1. Setup JupyterHub properly

  2. In your pipenv project dir....

pipenv install --dev ipykernel
pipenv shell
python -m ipykernel install --user --name=<kernel-name>

This command will generate kernelspec as ~/.local/share/jupyter/kernels/kernel-name

Why this works?

JupyterHub just runs your jupyter notebook process as the same procedure as using jupyter notebook solely.

Env

  • Ubuntu 16.04.3
  • Python 3.6.5
  • pipenv 11.9.0
  • Jupyter 5.3.0
  • JupyterHub 0.8.1