Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Steps for settting up Jupyter notebook for virtual environment in Python (2019 guide)

Make sure you have jupyter installed and virtual envrionment set up already. I prefer virtualenv. If you don't have it set up, you can follow these steps,

$ pip install jupyter
$ pip install virtualenv
$ python -m virtualenv venv
$ source venv/bin/activate

Here, we've created virtual environment called venv and activated it.

Now, let's install kernel specific to your virtual environment that you'll be able to use in your notebook.

$ pip install ipykernel
$ python -m ipykernel install --user --name=some_cool_project_name

Now you can launch the jupyter notebook (from a different terminal) and select the kernel by going to Kernel > Change Kernel > some_cool_project_name via the menu.

Note I've installed the jupyter outside the virtual environment, but if you choose to install it inside, then you'll have to launch jupyter from inside the virtual environment instead of open a different terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment