I have a Jupyter lab installed on Windows. I installed Jupyter Lab on WSL Ubuntu. I can lunch Jupyter Lab from Linux terminal. This will open Jupyter Lab on Chrome browser
WSL 2 issues a dynamic IP address each time you launch WSL 2 -- see MSFT docs.
Personally, I run a Python command within a subshell to print that IP:
jupyter lab --ip $(python3 -c "import subprocess; subprocess.run(['hostname', '-I'], text=True).stdout")
This works for me on Ubuntu 20.04 and Windows 10 build 19041.329.
Note: You'll likely have to visit that IP address instead of localhost, plus the port through which you're running Jupyter, e.g. http://:8888 .
To get my IP address via the CLI I use:
ip addr | grep eth0 | grep inet
I choose the first IP address available, typically using that address without the subnet mask, i.e. the forward slash + number.
Run this command, this will run notebook on your eth0 ip address.
jupyter notebook --ip `ip addr | grep eth0 | grep inet | awk '{print $2}' | cut -d"/" -f1`
or
# Get eth0 IP address
HOST_ETH0_IP=`ip addr | grep eth0 | grep inet | awk '{print $2}' | cut -d"/" -f1`
# Run jupyter notebook for the IP address
jupyter notebook --ip $HOST_ETH0_IP
If you can set the ip address on the jupyter config
jupyter lab --generate-config
vim ~/.jupyter/jupyter_notebook_config.py
Then copy and paste the output of ip addr | grep eth0 | grep inet | awk '{print $2}' | cut -d"/" -f1
c.NotebookApp.ip = 'HOST_ETH0_IP'
Try going to \\wsl$\{wsl distro name}\home\{user name}\my_linux_folder\
Longer explanation: browse to \\wsl$\
and see what you see there. There should be a distro name (Ubuntu, perhaps?) then you will have access to the root filesystem of your WSL. You can go to the home directory, then select your username, then your files should look familiar.
You could go the other way, and point Jupyter to a windows folder from Linux. However, assuming you might be using WSL2, the first method has much better performance.
Update:
You can access the Linux files by modifying the configuration file. You'll need to allow root access and specify the Jupyter Notebook directory. The directory starts from the root directory of the Linux file system. You can also start from the Windows file system /mnt/c/users/admin/.jupyter
.
{
"NotebookApp": {
...
"allow_root": true,
"notebook_dir": "/home/admin/.jupyter",
...
}
}
Original:
Is there a particular reason you need to save the Jupyter Notebook files on the Linux file system? WSL has full access to the Windows file system so it shouldn't matter where the file is saved.
To add to Jason's point:
Apparently, WSL 2 uses a virtual network adapter that has its own IP address. It also changes the IP address every time the server is restarted. It got annoying having to manually update the IP address so I wrote a script to update it automatically.
I wrote an article about how to do it to make it easier for everyone:
How to Set Up the Jupyter Notebook Home and Public Server On Windows Subsystem for Linux 2 (WSL2)
The attached photo is a Notebook running on WSL 2 that's saved on the Windows 10 file system.