Using pipenv's virtualenv as a kernel in JupyterHub

April 21, 2018

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

©2011-2018 tuxedocat : Built with Hugo