Using pipenv in Jupyter Notebook

Ipykernel is the Python execution backend for Jupyter. Jupyter Notebook automatically ensures that Ipykernel is available but if I want to use a kernel in a virtual environment, I need to install it manually. (Read)

1. Install ipykernel in the project folder where my pipfile is located.

pipenv install ipykernel

2. Start the virtual environment.

pipenv shell

This will launch the virtual environment of the project.

(my-virtualenv-name) $

3. Install Python kernel with a name

python3 -m ipykernel install --user --name=my-virtualenv-name

In my case, I used ml-basics for my virtual env name.


You can now see the kernel name ml-basics in the kernel option.


Source: SlackOverflow


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s