DEV Community

vivek atwal
vivek atwal

Posted on

Enabling virtualenv on jupyter notebook

Introduction

Jupyter notebook make life easier for

  • Begineer to learn and understand step by step
  • Experts to explore data,visualiations.
  • Mentors to create course
  • Speakers for demonstration

While exploring same libraries have different versions and you need to test those version separately. They can be installed on separate virtualenvs.

Now in order to make this environment quickly accessible, we need to add this env to jupyter notebook as kernels.

Below are the steps:

Jupyter

Installation

sudo apt install jupyter-core
Enter fullscreen mode Exit fullscreen mode

Activate the env and the install ipykernel

pip install ipykernel
Enter fullscreen mode Exit fullscreen mode

Inorder to differentiate different environemnt, you have to name them, Name them with along with packgae version

ipython kernel install --user --name=envname_pkg_v1
Enter fullscreen mode Exit fullscreen mode

To view all the environment

jupyter kernelspec list
Enter fullscreen mode Exit fullscreen mode

Remove environment from jupyter

jupyter kernelspec uninstall envname
Enter fullscreen mode Exit fullscreen mode

Discussion (2)

Collapse
edublancas profile image
Eduardo Blancas

great resource for people getting started with Jupyter, thanks for sharing! I'm part of a growing community of jupyter users, it'd be great if you join!

Collapse
vivekatwal profile image
vivek atwal Author

Thanks for reaching out, I am glad you like it