-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launching notebook to browser on WSL #4594
Comments
I tried fixing it by typing the following command and then run 'jupyter notebook' Kindly help. |
A solution is to download firefox or chrome in your WSL This should work, make sure to test that you have the browser working after installing before testing with jupyter notebook. |
Here go more details to launch from a native browser on WSL:
Caveats: per my testing, new windows got opened up automatically after putting in the settings listed above. Yet, the Firefox window is "oversized," and I needed to look for it and resize it properly. Please advise if you have a better way to rescale the auto-started Firefox by A bit more echoing for the original posting:Before switching to |
I installed firefox using the command 'sudo apt install firefox'. Failed to connect to Mir: Failed to connect to server socket: No such file or directory I am not sure how to proceed. My windows firewall is also turned off. Kindly help. Thanks. |
@raghavven Let's try to start simple: how about simply start
Then, it seems that your WSL did not install Firefox to |
Dear IIinfeng I installed firefox and is found in the path (after typing the command"type -a firefox"), '/usr/bin/firefox'. When I try to start firefox by simply typing 'firefox' in the terminal, I get the following error. Error: no DISPLAY environment variable specified. Kindly help. Thanks. |
How about you try to run the following command in your WSL terminal: Then, within the same terminal session, try to run |
Please note, the performance of these |
I first ran the command 'export DISPLAY=localhost:0.0' and then ran the following commands "irefox I understand , what you are saying. I should be able to simply copy past the jupyter notebook link on firefox or chrome and it should work. I am just unable to understand what is wrong. Thanks. |
@raghavven I suggest that you may start Googling around and testing different parameters for the |
@llinfeng IIinfeng I understand, thanks for your help. really appreciate it. |
@thomasaarholt When you set |
Dear @martin2384798 I do as you recommended, that but Jupyter notebook aslo cannot launch Chrome. Do you have any other Ideas? Thank |
@thangckt Start jupyter notebook service by running |
@martin2384798 ... yes, it correctly opens jupyter notebook webpage. So how I can make such address (i.e. 127.0.0.1:8888) to be opened automatically by typing "jupyter notebook"? |
Donno, did research before but no method found.
…On Tue, Aug 6, 2019 at 1:48 PM thangckt ***@***.***> wrote:
@martin2384798 <https://github.com/martin2384798> ... yes, it correctly
opens jupyter notebook webpage. So how I can make such address (i.e.
127.0.0.1:8888) to be opened automatically by typing "jupyter notebook"?
Thank.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4594?email_source=notifications&email_token=ADA3OF6J7NCD7EYRCSLKJJ3QDEGBHA5CNFSM4HIVXE52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3T552Q#issuecomment-518512362>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADA3OF52KAQIMV2PGF2X6ADQDEGBHANCNFSM4HIVXE5Q>
.
|
Hi @thomasaarholt ! I recently decided to try WSL and also wanted to solve this. My solution includes creating a "Jupyter Notebook here" button in my context menu, which basically points to a terminal of choice (I use cmder) and runs a jupyter_notebook.sh script therein. There is still a caveat. Because of some permission misshap, the jupyter notebook will not work in some folders especially dear to windows, such as your user folder. It still works in subfolders. I share the code below for those interested. Best regards, This is the Cmder task, which is added to the windows registry key command. set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl /mnt/c/users/aeljarrat/test/jupyter_notebook_here.sh -cur_console:pm:/mnt The #! /bin/bash
# I need to source conda
source ~/anaconda3/bin/activate base
# Find the interesting output in stderr
mycmd='jupyter notebook --no-browser'
exec 3< <($mycmd 2>&1)
a=$(grep -o -m1 'http://localhost.*' <&3)
echo $a
# Use preferred browser here
/mnt/c/Program\ Files/Mozilla\ Firefox/firefox.exe "$a"
# This keeps the terminal alive as we get the rest of the output
cat <&3 You can also use this script to open a notebook from the windows side, for instance; wsl jupyter_notebook_here.sh |
@AEljarrat Not sure if small world, or if we're just very vocal. @martin2384798 The main issue is that calling the jupyter notebook command opens a browser window with the I'm tempted to suggest a change to the code so as to have the option of defaulting to open the IP path (localhost) or the nbserver html file. The |
What it works for me is as follows:
Then I configured Then, I launch Hope it works for you too. |
l just type |
|
Chrome for me is installed on my User account instead of Program Files, so using the correct path, the solution worked very nicely. Thank you @salihyanikgonul |
@AEljarrat, your script worked like a charm for me. Thanks for sharing. The only tweak I made was to use the wslview utility (https://github.com/wslutilities/wslu/wiki/wslview), which then just opens the jupyter notebook in the default browser of Windows:
|
@juankikushima I am having the same issue in that my browser will automatically open, but it will try and open on the file rather than the URL! Anyone got any ideas how to fix that @salihyanikgonul ? |
I have found how to fix this - i..e to have jupyter notebook launch from WSL in a windows web browser. There is a setting in the jupyter_notebook_config.py to force notebook to launch using the URL, not a redirect file. c.NotebookApp.use_redirect_file = False If you have your browser environment variable set, then running 'jupyter notebook' should now open it with http://localhost:8888/tree instead of the redirect file by default. |
Hi @acse-ogb119 but I got this message when I try your suggestion: Config option Do you know what I might be doing wrong? |
For reference, you can also set jupyter notebook: BROWSER=/mnt/c/path/to/firefox.exe jupyter notebook --NotebookApp.use_redirect_file=False jupyter lab: BROWSER=/mnt/c/path/to/firefox.exe jupyter-lab --LabApp.use_redirect_file=False |
Try using @cmfcmf 's suggestion, that also works for me and is neater! Note that I have my BROWSER environment variable set in .bashrc so do not need to preceed the command with BROWSER=... Hope it works! |
I've tried this, and it still doesn't work. It seems like no matter how I try to use NotebookApp.use_redirect_file=False, it just simply doesn't work. The terminal displays: Would appreciate help with this issue. |
wslview going to handling
|
Please upgrade your notebook version because that option requires notebook 6.0.2 or above. After upgrading, I could solve the problem that a redirect file is launched 😂 |
Work good for me even without the alias, for opening jupyter lab on WSL with the new Edge browser on Windows. Much thanks! |
A combination of all of the advice above worked for me. I'm running Ubuntu 18.04 in WSL1. I'm launching jupyter notebook from a Python/Django project. Here are all the steps I followed:
|
Hi sachika. Please open a separate issue as your problem is unrelated to this one. |
I didn't use the alias. Simply just these two and I can launch Jupyter Notebook from WSL.
Cheers |
|
In jupyter lab 3.0.8, the |
@salihyanikgonul I have tried this but getting the error
|
After updating |
Hi I tried the following and it worked: I set an alias to chrome.exe in my .bashrc file as above: I open my jupyter notebooks on localhost:8888 so I made another alias to open this page and run jupyter notebook. The webpage had to be opened first as after jupyter notebook is run it does not run the next command in the alias. When I use the command notebook now it very satisfyingly opens the chrome tab with the notebook immediately. |
For me, just setting The jupyter configuration file (jupyter_notebook_config.py) in a section specifies:
Since this uses the |
I find a solution: Generate config
then
find
next, export BROWSER in your ~/.bashrc or ~/.zshrc. for example: export BROWSER="/mnt/c/Users/guodongxiaren/AppData/Local/Google/Chrome/Application/chrome.exe" finally, just run |
WSL = Windows Subsystem for Linux aka "Bash on Ubuntu on Windows" or "Running Linux on Windows".
Currently, in order for WSL to recognise Windows browsers, the
$BROWSER
environment variable needs to be set:export BROWSER='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
However, the following text printed after calling
jupyter notebook
helps explain my issue.Currently, the browser window opens with the first of those two links. And since Chrome is a windows browser, that address doesn't exist for it.
My questions are:
The text was updated successfully, but these errors were encountered: