Use virtualenv with a Python Jupyter notebook

· Thomas Taylor

Using a virtual environment with a Jupyter notebook is easy!

Install and use virtualenv

For instructions on installing, using, and activating virtualenv, refer to my blog article here.

NOTE: You may use your virtual environment of choice.

Add virtualenv environment to Jupyter notebook

  1. Activate the virtual environment
  2. Install ipykernel
1pip3 install ipykernel
  1. Use the ipykernel install command
1python3 -m ipykernel install --user --name=venv # this name can be anything
  1. Open jupyter-lab and click on the environment labeled venv

The ipykernel install command uses the current environment when creating the kernel.


Reply to this post by email ↪