Using virtualenv in Jupyter Notebook

There are words that may take minute(s)
  • OS: macOS High Sierra 10.13.4
  • Default Python version: 3.6.5

Prerequisites

  1. Have your Jupyter Notebook and virtualenv installed with your default python version
  2. Have one virtual env created which you want to use

Walkthrough

Activate your virtualenv

source <envpath>/bin/activate

Install ipykernel inside your env

$(yourenv)> pip install ipykernel

Create kernel using your env

$(yourenv)> python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

Go ahead and enjoy

Now open your jupyter notebook and you'll notice your kernel just created appears along with your default kernel. Enjoy it😀