Jupyter Notebook in Windows Subsystem for Linux |WSL

Harshit Yadav
2 min readJul 2, 2019

--

Python installation on WSL

Although Python comes preinstalled with most of the Linux distributions but unfortunately it doesn’t comes with WSL. So you have to install it manually and to do that write the following commands —

sudo apt update && upgradesudo apt install python3 python3-pip ipython3sudo apt install python3-pip

This is it. This will install Python 3 in your WSL. To check python version type

python3 --version

Installing Jupyter Notebook

You can run Jupyter Notebook in your WSL. Here WSL will act as a jupyter server accessible at localhost with port 8888. The steps to install Jupyter is as following-

  1. Install Jupyter by typing the following command in your Bash Shell.
pip3 install jupyter

It will take some time and install all the packages to be installed

You can run the jupyter notebook from anywhere (i.e., from the Linux or Windows filesystem). The WSL will act as a jupyter server accessible at localhost with port 8888.

Switching to Browsers Installed in Windows

Create alias to launch jupyter without browser from the WSL:
- Open your bash configuration: vim ~/.bashrc
- Add to the end of the file and save/exit:
alias jupyter-notebook="~/.local/bin/jupyter-notebook --no-browser"

Now you can run a jupyter server jupyter-notebook and access the service with your browser from Windowslocalhost:8888.

When Running for the First time will present you with withs Screen

Now Head back to you WSL Terminal and use the Token to set your Password

And if everything works well

The notebooks you upload get stored in the location inside WSL

/home/harshit95/.jupyter

or if not you can check the paths used by jupyter by typing :

jupyter --path

Happy WSL-ing :)

--

--

Harshit Yadav
Harshit Yadav

Written by Harshit Yadav

Software Developer | Azure Solution Architect Expert | Technical Writer | harshityadav.in

Responses (5)