Skip to content

Instantly share code, notes, and snippets.

@Dovineowuor
Forked from lucasrodes/VENVJUPYTER.md
Created November 4, 2022 08:42
Show Gist options
  • Save Dovineowuor/c0c91c9e2e95cd9b18735e13267eeaea to your computer and use it in GitHub Desktop.
Save Dovineowuor/c0c91c9e2e95cd9b18735e13267eeaea to your computer and use it in GitHub Desktop.
Setting a Virtual Environment In Jupyter Notebooks

If you are using a virtual environment, follow the steps below to setup it for the Jupyter Notebook.

Enter your virtual environment

$ source <envname>/bin/activate

Install IPykernel

$ pip3 install ipykernel`

Create an IPython kernel

Next, run the following command to create a kernel in order to use our virtual environment in the Jupyter Notebook

$ python3 -m ipykernel install --user --name <envname> --display-name "<envname>"

Run Jupyter and choose your kernel

You should now be able to select the created kernel from the Jupyter menu bar (Kernel/Change kernel, see picture below).

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