PUMA1192
PUMA1192

Reputation: 21

Trouble launching Jupyter Notebook browser from WSL Ubuntu

I do most of my programming on my WSL Ubuntu 20.04 partition, and therefore I want to use Jupyter Notebooks in the Ubuntu BASH - but I want to have a browser open to work with the Jupyter Notebook cells. Since WSL Ubuntu is CLI only, I need to open a tab on my Windows 10 browser while launching Juptyer Notebooks from wsl BASH in order to work with multiple cells for data visualization.

I have successfully gotten this to work by manually typing the following command:

BROWSER=/mnt/c/Program\ Files\ \(x86\)/Microsoft/Edge/Application/msedge.exe jupyter notebook --NotebookApp.use_redirect_file=False

When I type the above command, Jupyter Notebooks successfully opens and creates a server at localhost:8977/tree on my Ubuntu Partition, as can be seen below:

Jupyter Notebook Launching Successfully

The problem arises when I try to overwrite the Jupyter Notebooks configuration file and .bashrc file, so that I don't have to manually type the above command every time I want to start jupyter notebooks.

I have followed the following steps, but I cannot get it to work:

Generate the jupyter_notebook_config.py file:

jupyter notebook --generate-config

Modify the file:

nano ~/.jupyter/jupyter_notebook_config.py

and change c.NoteBookApp.use_redirect_file value to False.

c.NotebookApp.use_redirect_file = False

Finally, I add the following line to ~/.bashrc

export BROWSER="/mnt/c/Program\ Files\ \(x86\)/Microsoft/Edge/Application/msedge.exe"

Quite frankly I'm stumped; as far as I can tell, I have done everything exactly as I do it with the standalone command, but when I run the jupyter notebook command with the above changes, I get the following error:

Error when launching Jupyter Notebook

What am I doing wrong? Why does the command work when I type it explicitly but not when I modify these files? Am I doing something wrong, or missing anything in the configuration file?

Thank you for your time!

Upvotes: 1

Views: 2686

Answers (1)

Marco Ycaza
Marco Ycaza

Reputation: 11

maybe this helps as another workaround:

Open your .bashrc file and add:

alias notebook='BROWSER=/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe jupyter notebook --NotebookApp.use_redirect_file=False' enter image description here or in your case:

alias notebook='BROWSER=/mnt/c/Program\ Files\ (x86)/Microsoft/Edge/Application/msedge.exe jupyter notebook --NotebookApp.use_redirect_file=False'

And then just open your ubuntu terminal , type : using alias

and that should be enough. Of course its up to you to choose the alias you prefer.

Upvotes: 1

Related Questions