Jupyter Notebook in project’s virtual env

I write Java for a living. I work mostly in the Hadoop ecosystem which is very Java centric. This has limited my exposure to other languages in the last couple of years.

Recently, I have been trying to pick up some python. In beginning my main motivation to learn python was to able to write some small script to automate different day to day tasks at work.
Although, after spending some time with the language I am in love! The initial need for writing small scripts has now changed to build something.

To play neatly I always use a virtual environment and if I am going to do any web scraping or data analysis I install Jupyter notebook in the project’s venv in the following way:

Create a new project directory and switch directory:

$ mkdir my_new_project

$ cd my_new_project

Create a virtual environment. My global .gitignore is already configured to ignore venv directories.

$ python3 -m venv venv

Activate the virtual environment

$ source venv/bin/activate

Check your venv (if needed)


To install and use Jupyter notebook in project’s virtual environment

$ pip3 install jupyter

$ jupyter notebook