Search code examples
jupyter-notebookwindows-subsystem-for-linux

Jupyter being launched using file location via WSL


I'm having an issue with how Jupyter attempts to open up in my browser. When running jupyter notebook it attempts to open this file location in my default browser file:///home/david/.local/share/jupyter/runtime/nbserver-56-open.html The issue is that because my browser works in a Windows environment the browser is trying to open a path that doesn't actually exist according to Windows. I would like to know if there exists a file that can change the address used in my browser, either the correct file location in my Windows environment or just have is use the URL http://localhost:8888?

Thanks!

EDIT: Just to specify, Jupyter itself works fine, it just requires me type http://localhost:8888 manually into the URL bar of my browser. I'm just curious if there's a means to avoid manually entering the URL. It's hardly a problem but I'd still like the convenience of it opening when I type the command in terminal.


Solution

  • The path in WSL is not accessible by native windows applications, so your browser cannot open that file. You can open the URL directly in the WSL bash with the following command:

    $ jupyter notebook --no-browser  --port 8888
    $ /mnt/c/Windows/system32/cmd.exe /c "start http://localhost:8888"
    

    The second line will load your default browser according to this post. You can also call a specific browser (e.g. IE, FireFox or Chrome) directly:

    $ '/mnt/c/Program Files/internet explorer/iexplore.exe' http://localhost:8888