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 is broken in Firefox #4500

Closed
edumorlom opened this issue Mar 20, 2019 · 26 comments
Closed

Jupyter Notebook is broken in Firefox #4500

edumorlom opened this issue Mar 20, 2019 · 26 comments

Comments

@edumorlom
Copy link

Screen Shot 2019-03-20 at 12 53 44 AM

When I run 'jupyter notebook' it will open the html file in the filesystem and will be displayed incorrectly in the Firefox 67 and 68 (current Betas, I haven't tested 66). This issue does not happen in Chrome or Safari.
file:///Users/eduardomorales/Library/Jupyter/runtime/nbserver-81921-open.html

The only way to fix this is to access the URL provided in the terminal instead.
http://localhost:8888/?token=57035d2f78d7578f424d28e280855612e6d4b6cfb73f5de7

@fxthomas
Copy link

Seems to be an issue with the most recent release. Using an older release works:

pip install notebook==5.6.0

@kfrncs
Copy link

kfrncs commented Apr 9, 2019

thank you! this fixed it. This is the third thread I found about this issue, btw.

@lead0r
Copy link

lead0r commented Apr 9, 2019

I also have the same problem, only in Firefox. I don't think using an older version of notebook is a fix, though.

Does anyone know why this happens?

@skagr
Copy link

skagr commented Apr 14, 2019

Confirmed not working on Firefox 67 (MacOS Mojave)

Cause is this commit, which changed the way Jupyter Notebook is opened in the browser:
270c0f9#diff-f68f5eab41b9092b5b739944f53d5730

Instead of opening <base-url>/?token=<token> directly, an nbserver-<pid>-open.html file is now created which redirects to <base-url>/tree?token=<token>

Safari and Chrome have no problems with this redirect, but Firefox does. I have edited the nbserver-<pid>-open.html file to remove the tree part and can confirm that this does work in Firefox.

By the way: this same problem exists in jupyter lab

@0n0n0m0uz
Copy link

the nbserver--open.html is generated new each time the notebook is run so editing the html file only works for a few hours. What exactly is it about firefox that it can't handle the redirect? I was trying to tweak the code directly(open_url, default_url?) but spent hours for such a stupid little fix. At some point the /tree is needed but just not in the final html file creation. I am a newbie so this was definitely learning opp for me. I am following along on my own machine.

@josphat-n
Copy link

Seems to be an issue with the most recent release. Using an older release works:

pip install notebook==5.6.0

This solved my issue too, after spending much time diagnosing and attempting several options in vain!

@prokotg
Copy link

prokotg commented Jun 18, 2019

Still an issue in new versions of notebook (for Opera), had to go back to 5.6.0

@riteshjn
Copy link

I have the same issue!

pntbttrvbs referenced this issue Aug 7, 2019
This avoids putting the authentication token into a command-line
argument to launch the browser, where it's visible to other users.
Filesystem permissions should ensure that only the user who started the
notebook can use this route to authenticate.
Thanks to Dr Owain Kenway for suggesting this technique.
@pntbttrvbs
Copy link

pntbttrvbs commented Aug 7, 2019

I am having the same issue ("Access to file was denied") on Ubuntu 18.04.3 (and 16.04) using Firefox and Opera.

My specific issue is because Firefox was installed using Snap. Firefox can't access anything outside the home directory. Moving the nbserver--open.html file to the /home/user/ directory let both Firefox and Opera open it.

It looks like this is the intended way snap-installed apps are meant to function, so I'm not sure there's a good fix for this.

@raespinoza4
Copy link

Seems to be an issue with the most recent release. Using an older release works:

pip install notebook==5.6.0

I had the same issue using Opera on Ubuntu 18.04 and this fixed it !

@christnp
Copy link

christnp commented Sep 13, 2019

Also broken in notebook=6.0.1 & 6.0.0 when using Chromium on Ubuntu 18.04.3. Had to install version 5.6.0 as suggested... seems weird that there has been a major version change but the issue persists. Make me wonder what I'm doing wrong? :-/
EDIT: fixed "Chrome" reference... it is "Chromium" FWIW

@ddobrinskiy
Copy link

Also broken for me:

  • Jupyterlab 1.1.3
  • Ubuntu 19.04
  • Firefox 69.0.3 (64-bit) Snap for Ubuntu

@KreMic
Copy link

KreMic commented Oct 21, 2019

I consider the same problem with Firefox since some versions currently I am on FF 70 under Arch Linux. I have to copy the URL and directly open it in the browser address field.
BUT I run a sandboxed Firefox via Firejail. When I run a non sandboxed instance directly via /usr/bin/firefox, Jupyter-Notebook – currently version 6.0.1 – starts and runs fine like it used to before.
Although I have in mind everything worked fine with Firejail too I do not remember the versions of Firefox, Firejail or jupyter-notebook when it stopped working.

@pakutoma
Copy link

pakutoma commented Dec 2, 2019

I have the same issue on Windows Subsystem for Linux (WSL). Because browsers running in Windows can't access files in WSL. I hope to choose either URL access or redirect in settings.

@mdmurbach
Copy link

Setting c.NotebookApp.use_redirect_file = False as described here (#4353 (comment)) solves this for me

@germanjke
Copy link

germanjke commented Jul 15, 2020

yes this command helped me with Ubuntu 20.04 and Chromium / 15th July 2020
pip install notebook==5.6.0

@ghost
Copy link

ghost commented Aug 4, 2020

I was also facing the same issue i changed the default setting of browser from Firefox to Chrome it will continue to work

@solo7773
Copy link

solo7773 commented Aug 18, 2020

Setting c.NotebookApp.use_redirect_file = False as described here (#4353 (comment)) solves this for me

Not working for me

Ubuntu 18.04
Jupyter Notebook 6.1.3
FF developer edition 80.0b8 64-bit

@microsupportau
Copy link

I have found this is AppArmor for me on ubuntu 20.04, if my default browser is mozilla it opens fine, I have chromium installed from snap store.

if you do a: tail -f /var/log/syslog you may see the reason as below. I have not looked to modify the policy just yet to allow.

apparmor="DENIED" operation="open" profile="snap.chromium.chromium" name="/home/username/.local/share/jupyter/runtime/nbserver-55637-open.html" pid=3385 comm="ThreadPoolForeg" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

@raffaem
Copy link

raffaem commented Dec 14, 2020

I had this same problem

Kubuntu 20.10
Chromium Version 87.0.4280.88 (Official Build) snap (64-bit)

Two solutions:

  1. Downgrade notebook

pip install notebook==5.6.0

  1. Disable redirect
$ jupyter-notebook --generate-config
Writing default config to: /home/<USER>/.jupyter/jupyter_notebook_config.py

Open that file, uncomment this line and set it to False (it is commented and set to True by default)
c.NotebookApp.use_redirect_file = False
All from command line:

jupyter-notebook --generate-config
sed -i 's/#c\.NotebookApp\.use_redirect_file\s=\sTrue/c\.NotebookApp\.use_redirect_file=False/g' /home/$USER/.jupyter/jupyter_notebook_config.py

Can we push this upstream? It has been almost two years since this issue is open

@pwuertz
Copy link

pwuertz commented Nov 25, 2021

Doesn't seem to work for jupyter lab. Added the flag to the configuration file but it is ignored.

@mcourteaux
Copy link

mcourteaux commented Dec 5, 2021

The real reason is that your browser (chrome, chromium, opera, ...) is installed as a snap application. Snap prevents access to hidden files. The files are in ~/.local/share/jupyter/runtime. IMO this is a great security feature: I don't want my browser to access my ssh keys sitting in ~/.ssh. My suggested solution is that jupyter places the launch file in /tmp/ or ~ and deletes it whenever the server is successfully accessed.


Alternatively for the Jupyter Lab, I patched this file: ~/.local/lib/python3.8/site-packages/jupyter_server/serverapp.py. Around line 1048 is the property use_redirect_file. I put the default value to False:

    use_redirect_file = Bool(False, config=True,
        help="""Disable launching browser by redirect file

@radenkovpy
Copy link

I had the same problem.

Ubuntu 20.04.3 LTS
Chromium Version 96.0.4664.110 (Official Build) snap (64-bit)

This was the solution in my case:

  • Create the configuration file: jupyter-notebook --generate-config
  • Edit the configuration file /home//.jupyter/jupyter_notebook_config.py and set:
    c.NotebookApp.use_redirect_file = False

Make sure that this configuration parameter starts at the beginning of the line. If you leave one space at the beginning of the line, you will get the message that access to the file was denied.

@dpanici
Copy link

dpanici commented Apr 7, 2022

This works for jupyter notebook, but when launching jupyter lab I still get an access denied, is there an additional config setting that needs to be set for jupyter lab?

@ralberrto
Copy link

The corresponding issue with jupyter lab is solved by:

  • Running jupyter-lab --generate-config
  • Editing the configuration file at ~/.jupyter/jupyter_lab_config.py; if the line is hashed out unhash it and change c.ServerApp.use_redirect_file = True to c.ServerApp.use_redirect_file = False

That should do it, good luck! Thanks to @radenkovpy for the actual solution, I merely extrapolated it to jupyter lab.

@eyildiz-ugoe
Copy link

I had this same problem

Kubuntu 20.10 Chromium Version 87.0.4280.88 (Official Build) snap (64-bit)

Two solutions:

1. Downgrade notebook

pip install notebook==5.6.0

2. Disable redirect
$ jupyter-notebook --generate-config
Writing default config to: /home/<USER>/.jupyter/jupyter_notebook_config.py

Open that file, uncomment this line and set it to False (it is commented and set to True by default) c.NotebookApp.use_redirect_file = False All from command line:

jupyter-notebook --generate-config
sed -i 's/#c\.NotebookApp\.use_redirect_file\s=\sTrue/c\.NotebookApp\.use_redirect_file=False/g' /home/$USER/.jupyter/jupyter_notebook_config.py

Can we push this upstream? It has been almost two years since this issue is open

This solved the issue for me. Ubuntu 22.04, Anaconda env, Firefox browser.

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