Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access Jupyter notebook stored in Windows when Jupyter runs from Ubuntu WSL?

I have setup WSL (Windows Subsystem for Linux) on Windows 10 and installed Anaconda with python 3 and jupyter lab included. When launching Jupyter lab, I am asked to copy paste http://localhost:8888/lab in my browser, and that works fine. However, I don't know how to access to all my notebooks stored in Windows, I can't browse Windows through Jupyter Lab.

I have searched in Google but can't find the answer.

Does anyone have an idea on how I can browse my notebooks folder stored in Windows?

like image 654
Lanmar Avatar asked May 28 '19 17:05

Lanmar


2 Answers

Juggling files between different environments can be a big productivity killer, as you are already finding out. A potential approach would be to:

  1. Organize your files on your local PC into a repository using github.com or equivalent, and pushing those files to your account.

  2. Open a new terminal window in your Jupyter Lab, and pull the repo, substituting your name and email:

$ sudo apt install git
$ git config --global user.name "username" 
$ git config --global user.email "email" 
$ git init 
$ git clone
  1. If you are not already doing, so it may also help you to use a conda environment, and add the spec file to your github repo so that you always know conda environment specification regardless if you are in windows or WSL (or on another server altogether).
$ conda list --explicit > spec-file.txt
$ git add spec-file.txt
$ git commit -m "added spec file for conda environment"
  1. If you installed jupyter using conda, then your conda environment should be 'selectable' within Jupyter Lab, but if not, there are other posts on stackoverflow that show how to configure Jupyter Lab to make sure you can select your various conda environments.
like image 162
Professor Rumble Pony Avatar answered Sep 22 '22 14:09

Professor Rumble Pony


Create config file:

jupyter notebook --generate-config

Edit it with text redactor:

nano ~/.jupyter/jupyter_notebook_config.py

Set desired starting directory:

c.NotebookApp.notebook_dir = '/mnt/c/Users/Username/Path'
like image 44
matherialist Avatar answered Sep 23 '22 14:09

matherialist