I am using jupyter on WSL2. As you may know, Windows does not have access to the WSL2 file system, however WSL2 does have access to the Windows file system via /mnt/c/...
It is possible to get WSL2 to launch the Windows browser correct by doing the following:
First, export the environment variable BROWSER=/mnt/c/Program Files/...
(for example export BROWSER=/mnt/c/Program Files/Google/Chrome/Application/chrome.exe
)
This will cause WSL2 jupyter to correctly launch your Windows browser, however jupyter passes the address of a redirect file to the browser, as follows:
file:///home/<myhomedir>/.local/share/jupyter/runtime/<filename>
but windows cannot see this file because it is in the WSL2 file system. This can be easily fixed as follows:
Edit the file: ~/.jupyter/jupyter_notebook_config.py
and set c.ServerApp.use_redirect_file = False
.
By setting this value to False
the server will not send the browser file:///home/...
but will instead send the browser http://localhost:8889/?token=...
This works great for the jupyter notebook
command.
The problem is the jupyter lab
command still sends file:///home/...
Does anyone know a way to force the jupyter lab
command to NOT use a redirect file but rather to send http://localhost:8889/?token=...
instead??
I have looked around for a file or config equivalent to ~/.jupyter/jupyter_notebook_config.py
and c.ServerApp.use_redirect_file
that works for jupyter lab
but I can’t seem to find one.