Jupyter notebooks are the defacto standard for exploratory data analysis. With increasingly fucked-up dependency management it makes sense to use virtual environments and/or docker to manage dependencies per project. However, it makes more and more cumbersome to use it with jupyter notebooks. With conda, the nb_conda
package helps, but virtualenvs need to be registered separately.
0.) Install jupyter
, if missing, and ipykernel
for the default user
pip3 install --user --upgrade jupyter ipykernel
1.) Create a venv
python3 -m venv `~/venvs/this_env`
2.) Install jupyter
and ipykernel
inside the venv
source ~/venvs/this_env/bin/activate
pip install --upgrade jupyter ipykernel
# install other packages
3.) Register venv
# while inside activate `this_env`
python3 -m ipykernel install --user --name this_env
4.) Launch a jupyter notebook from outside this_env
and the kernel should appear as selectable