notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Jupyter Notebook is broken in Firefox

Open edumorlom opened this issue 5 years ago • 26 comments

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

edumorlom avatar Mar 20 '19 05:03 edumorlom

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

pip install notebook==5.6.0

fxthomas avatar Mar 22 '19 09:03 fxthomas

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

kfrncs avatar Apr 09 '19 22:04 kfrncs

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?

lead0r avatar Apr 09 '19 22:04 lead0r

Confirmed not working on Firefox 67 (MacOS Mojave)

Cause is this commit, which changed the way Jupyter Notebook is opened in the browser: https://github.com/jupyter/notebook/commit/270c0f96d761ec3c81e0ef3dae6f39d88677d6b5#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

skagr avatar Apr 14 '19 12:04 skagr

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.

0n0n0m0uz avatar Apr 19 '19 15:04 0n0n0m0uz

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!

josphat-n avatar May 17 '19 21:05 josphat-n

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

prokotg avatar Jun 18 '19 09:06 prokotg

I have the same issue!

riteshjn avatar Jul 22 '19 09:07 riteshjn

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.

pntbttrvbs avatar Aug 07 '19 20:08 pntbttrvbs

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 !

raespinoza4 avatar Aug 25 '19 19:08 raespinoza4

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

christnp avatar Sep 13 '19 05:09 christnp

Also broken for me:

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

ddobrinskiy avatar Oct 16 '19 10:10 ddobrinskiy

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.

KreMic avatar Oct 21 '19 20:10 KreMic

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.

pakutoma avatar Dec 02 '19 18:12 pakutoma

Setting c.NotebookApp.use_redirect_file = False as described here (https://github.com/jupyter/notebook/issues/4353#issuecomment-570564277) solves this for me

mdmurbach avatar Jan 17 '20 20:01 mdmurbach

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

germanjke avatar Jul 15 '20 18:07 germanjke

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

ghost avatar Aug 04 '20 07:08 ghost

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

solo7773 avatar Aug 18 '20 01:08 solo7773

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

microsupportau avatar Nov 18 '20 10:11 microsupportau

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

raffaem avatar Dec 14 '20 16:12 raffaem

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

pwuertz avatar Nov 25 '21 08:11 pwuertz

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

mcourteaux avatar Dec 05 '21 10:12 mcourteaux

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/<USER>/.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.

radenkovpy avatar Dec 24 '21 13:12 radenkovpy

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?

dpanici avatar Apr 07 '22 04:04 dpanici

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.

ralberrto avatar Jun 14 '22 03:06 ralberrto

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.

eyildiz-ugoe avatar Aug 15 '22 07:08 eyildiz-ugoe