Ask Your Question
1

Firefox not launching jupyter session properly

asked 2022-03-25 15:31:58 +0100

brettpim gravatar image

updated 2022-03-25 15:39:22 +0100

I am running Ubuntu 21.10 on a Lenovo Thinkpad X1 Tablet. I use Firefox 98.0.2 (64-bit) as my browser. When I run sage -n jupyter file.ipynb A new tab opens in firefox with address file:///tmp/tmp9csp8qpp.html but Firefox reports

File not found

Firefox can’t find the file at /tmp/tmp9csp8qpp.html.

Check the file name for capitalization or other typing errors.
Check to see if the file was moved, renamed or deleted.

However the file does exist. ls -l /tmp/tmp9csp8qpp.html returns

-rw------- 1 brett brett 751 Mar 25 10:15 /tmp/tmp9csp8qpp.html

If I open the file in Firefox directly using Open File... from the File menu everything works fine.

When I run sage -n jupyter file.ipynb I get some other links in the terminal to use for opening the jupyter session in my browser:

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

If I open the first of these, Firefox reports

Access to the file was denied

The file at /home/brett/.local/share/jupyter/runtime/nbserver-101452-open.html is not readable.

It may have been removed, moved, or file permissions may be preventing access.

However I have both read and write privileges for this file; ls -l /home/brett/.local/share/jupyter/runtime/nbserver-101452-open.html returns

-rw-rw-r-- 1 brett brett 667 Mar 25 10:15 /home/brett/.local/share/jupyter/runtime/nbserver-101452-open.html

I tried changing the privileges to include x but Firefox still will not open it.

Like above if I open the file in Firefox using Open File... from the File menu everything works fine.

edit retag flag offensive close merge delete

Comments

How did you install Sage (package ? Which one ? From source ? How ?) ? And what is your platform (OS, version) ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-03-25 22:03:59 +0100 )edit

I am running Ubuntu Linux 21.10. I cloned the SageMath repository with git. I compiled sage using directions in README.md. The most recent version I compiled was SageMath 9.4.

brettpim gravatar imagebrettpim ( 2022-03-25 22:51:22 +0100 )edit

-rw------- 1 brett brett 751 Mar 25 10:15 /tmp/tmp9csp8qpp.html

This is suspiciously short. Something is probably wrong with your compilation.

You should report this on sage-support, posting (a compressed version of) your compilation log ($SAGE_ROOT/install.log), where people with much more knowledge of Sage build process and quirks than me will give you a better (and more useable) answer....

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-03-25 23:51:12 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2022-03-29 17:49:43 +0100

brettpim gravatar image

The problem seems to be that Ubuntu's default Firefox is now installed with a snap package rather than via a .deb from a repository and snap installed applications do not have access to dotted files and redirect file is in ~/.local/. One solution suggested on Stackexchange Ask Ubuntu is to place the line

c.NotebookApp.use_redirect_file = False

in the jupyter configuration file $SAGE_ROOT/local/etc/jupyter/jupyter_notebook_config.py. This solution worked for me.

edit flag offensive delete link more

Comments

I am having this same issue, and this solution does not work. I installed with apt (apt list --installed | grep "sage" gives a whole bunch of entries), but $SAGE_ROOT is empty, so the directory/file you are suggesting to edit does not exist. Empty $SAGE_ROOT seems wrong to me, but I have a Slackware system that does not have this problem, and it also has empty $SAGE_ROOT. There is a .local/share/jupyter directory, but nothing in there looks like this .py file.

thethinker gravatar imagethethinker ( 2022-05-24 15:04:06 +0100 )edit

Thanks for sharing this. Your solution is really helpful for me.

mia02 gravatar imagemia02 ( 2024-03-05 10:25:02 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-03-25 15:31:58 +0100

Seen: 645 times

Last updated: Mar 29 '22