Skip to content
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

Jupyter Notebook does not load using ubuntu 18.04 LTS in windows 10 #191

Closed
mckot opened this issue Jun 20, 2020 · 6 comments
Closed

Jupyter Notebook does not load using ubuntu 18.04 LTS in windows 10 #191

mckot opened this issue Jun 20, 2020 · 6 comments

Comments

@mckot
Copy link

mckot commented Jun 20, 2020

The local host does not open on any browser.
The following error is shown.
`(venv) mayankkotambkar@LAPTOP-505GIUHT:~$ jupyter notebook
[I 09:03:50.236 NotebookApp] Serving notebooks from local directory: /home/mayankkotambkar
[I 09:03:50.237 NotebookApp] The Jupyter Notebook is running at:
[I 09:03:50.237 NotebookApp] http://localhost:8888/?token=89898adb9f0c296c9713bd70532d803321580391f1f9b7d6
[I 09:03:50.238 NotebookApp] or http://127.0.0.1:8888/?token=89898adb9f0c296c9713bd70532d803321580391f1f9b7d6
[I 09:03:50.238 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:03:50.246 NotebookApp]

To access the notebook, open this file in a browser:
    file:///home/mayankkotambkar/.local/share/jupyter/runtime/nbserver-40-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=89898adb9f0c296c9713bd70532d803321580391f1f9b7d6
 or http://127.0.0.1:8888/?token=89898adb9f0c296c9713bd70532d803321580391f1f9b7d6

Start : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1

  • Start "file:///home/mayankkotambkar/.local/share/jupyter/runtime/nbse ...
  •   + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
      + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand`
    
@mckot
Copy link
Author

mckot commented Jun 20, 2020

jupyter-notebook also doesn't work.

@attanew
Copy link

attanew commented Jul 29, 2020

I had the same problem as you. This is not my solution I find it here. Thanks to Atto Yusuke_konishi.

He has two methods to fix it and and I used method 1 and it worked:
$ jupyter notebook --NotebookApp.use_redirect_file=False

for jupyter lab:
$ jupyter lab --NotebookApp.use_redirect_file=False

to make it easy to use every time:

$ echo "alias jn='jupyter notebook --NotebookApp.use_redirect_file=False'" >> ~/.bashrc
$ source ~/.bashrc
$ jn

for jupyter lab"

$ echo "alias jb='jupyter lab --NotebookApp.use_redirect_file=False'" >> ~/.bashrc
$ source ~/.bashrc
$ jb

@Proteusiq
Copy link

Proteusiq commented Oct 15, 2020

I had the same problem as you. This is not my solution; I found it here. Thanks to Atto Yusuke_konishi.

He has two methods to fix it, and I used method one, and it worked:
$ jupyter notebook --NotebookApp.use_redirect_file=False

for jupyter lab:
$ jupyter lab --NotebookApp.use_redirect_file=False

to make it easy to use every time:

$ echo "alias jn='jupyter notebook --NotebookApp.use_redirect_file=False'" >> ~/.bashrc
$ source ~/.bashrc
$ jn

for jupyter lab."

$ echo "alias jb='jupyter lab --NotebookApp.use_redirect_file=False'" >> ~/.bashrc
$ source ~/.bashrc
$ jb

It is easier to place this setting in the jupyter_config.py file. In that way, you do not have to have an alias or editing of .bashrc

# Generate jupyter_config.py if it does not exists
jupyter jupyter notebook --generate-config

# Use nano or whatever editor. I use vs code
code ${USER}/.jupyter/jupyter_notebook_config.py

# Search and uncomment `c.NotebookApp.use_redirect_file=True` and set it to False
c.NotebookApp.use_redirect_file=False

In WSL 2, I had to add more to get the correct IP address.

# c.NotebookApp.ip = 'localhost'
import subprocess

c.NotebookApp.ip = subprocess.run(
    ["hostname", "-I"], capture_output=True, text=True
).stdout.strip()

@ivanov
Copy link
Member

ivanov commented May 8, 2021

I think you'd only run into this if you tried to set your BROWSER environment variable, because without it, you would either get a yellow warning message telling you "No web browser found: could not locate runnable browser." or a WSL installed webbrowser would be launched (for example, I have w3m and jupyter notebook by default will launch that in WSL.

You can find more about how to work around this issue to use the Windows browser over here: http://github.com/jupyter/notebook/issues/4594

I'm going to go ahead and close this one, as it is not a jupyter_core issue - the launched of the browser is done via the python webbrowser module in the jupyter-notebook subproject.

Happy hacking! :bowtie:

@dimpase
Copy link

dimpase commented Mar 29, 2022

This need not be a Windows-only problem. Basically, the browser might not have access to user's dotfiles (e.g. Firefox installed via snap). And then the only way around seems to be pass, in some way, e.g. as above, or in jupyter_notebook_config.py the parameter NotebookApp.use_redirect_file=False to jupyter.

Perhaps this issue should be better documented - e.g. we just spent time figuring this out: https://groups.google.com/g/sage-support/c/22Uj6xrP8zo/m/7M4OYU3qDgAJ

@dimpase
Copy link

dimpase commented Mar 29, 2022

@ivanov Another scenario where one sees this is when jupyter is launched in crostini (a Chromeos VM); then in crostini terminal (Debian guest OS) one sees

$ jupyter-notebook Untitled.ipynb 
[I 17:18:04.802 NotebookApp] Serving notebooks from local directory: /home/dimpase/foo/bar
[I 17:18:04.802 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 17:18:04.803 NotebookApp] http://localhost:8888/?token=a1afee7184e620439aafad309355c9d467ca1cf7a8642964
[I 17:18:04.803 NotebookApp]  or http://127.0.0.1:8888/?token=a1afee7184e620439aafad309355c9d467ca1cf7a8642964
[I 17:18:04.803 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:18:05.019 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/dimpase/.local/share/jupyter/runtime/nbserver-8789-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=a1afee7184e620439aafad309355c9d467ca1cf7a8642964
     or http://127.0.0.1:8888/?token=a1afee7184e620439aafad309355c9d467ca1cf7a8642964

but in the browser (Chrome running on the ChromeOS host) one sees ERR_FILE_NOT_FOUND, upon trying to open
file:///tmp/tmpounu3jr9.html (as the host OS has no access to guest's /tmp/)

Whereas

jupyter-notebook --NotebookApp.use_redirect_file=False Untitled.ipynb 

works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants