trouble with tokens when using notebook

90 views
Skip to first unread message

John Cremona

unread,
Mar 27, 2025, 2:51:33 PMMar 27
to SAGE support
When I want to run a notebook I start sage with "sage --notebook"
which used to open up a tab on my default browser (chrome) showing a
list of files in the directory where I issued the command. But now it
has started doing something different, namely showing a page which
wants a token to be entered in a box. This is despite the URL having
the token in it. And if I do paste in the correct token it responds
with "invalid credentials".

This is with ubuntu 24.04 and sage 10.6.rc0 (but 10.4 does the same).

It may be that it used to work before I upgraded from ubuntu 22.04
(and rebuilt sage after).

It does work OK with firefox, though that is not what sage opens by default.

John

John Cremona

unread,
Mar 28, 2025, 6:48:15 AMMar 28
to sage-support
I fixed it: looking carefully at the output led me to look at the permissions in /usr/local and I found that /usr/local/share (owbed by root) was rwxrwxrw-  so it was not possible for non-root to go there.  I changed it to rwxrwxr-x and now it works normally.

Issue closed!

John Cremona

John Cremona

unread,
Mar 31, 2025, 5:45:13 AMMar 31
to sage-support
I still have the problem.  Although what I did in my previous post "fixed" the issue once last week, this week I am back to not being able to use the notebook as it asks for a token but does not accept the token provided.  Here is the terminal output when I tun "sage --notebook".  If anyone has any idea what is causing this, I would be grateful.

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.6.rc0, Release Date: 2025-03-22                │
│ Using Python 3.12.3. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Sage doc server started running at http://127.0.0.1:36225
Please wait while the Sage Jupyter Notebook server starts...
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/tornado/ioloop.py:274: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
[I 2025-03-31 10:40:41.808 ServerApp] Package notebook took 0.0000s to import
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/traitlets/traitlets.py:3913: DeprecationWarning: Keyword `trait` is deprecated in traitlets 5.0, use `value_trait` instead
  warn(
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/traitlets/traitlets.py:3615: DeprecationWarning: Traits should be given as instances, not types (for example, `Int()`, not `Int`). Passing types is deprecated in traitlets 4.1.
  super().__init__(trait=trait, default_value=default_value, **kwargs)
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyter_lsp/handlers.py:6: DeprecationWarning: jupyter_server.base.zmqhandlers module is deprecated in Jupyter Server 2.0
  from jupyter_server.base.zmqhandlers import WebSocketHandler, WebSocketMixin
[I 2025-03-31 10:40:41.822 ServerApp] Package jupyter_lsp took 0.0139s to import
[W 2025-03-31 10:40:41.822 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2025-03-31 10:40:41.827 ServerApp] Package jupyter_server_terminals took 0.0048s to import
[I 2025-03-31 10:40:41.828 ServerApp] Package jupyterlab took 0.0000s to import
[I 2025-03-31 10:40:42.369 ServerApp] Package notebook_shim took 0.0000s to import
[W 2025-03-31 10:40:42.369 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2025-03-31 10:40:42.369 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2025-03-31 10:40:42.373 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2025-03-31 10:40:42.377 ServerApp] jupyterlab | extension was successfully linked.
[I 2025-03-31 10:40:42.380 ServerApp] notebook | extension was successfully linked.
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/traitlets/traitlets.py:1897: DeprecationWarning: ServerApp.token config is deprecated in jupyter-server 2.0. Use IdentityProvider.token
  return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
[I 2025-03-31 10:40:42.386 ServerApp] notebook_shim | extension was successfully linked.
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyter_server/_tz.py:33: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  dt = unaware(*args, **kwargs)
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyter_server/_tz.py:33: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  dt = unaware(*args, **kwargs)
[I 2025-03-31 10:40:42.403 ServerApp] notebook_shim | extension was successfully loaded.
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyter_server/extension/manager.py:115: DeprecationWarning: A `_load_jupyter_server_extension` function was not found in <module 'jupyter_lsp' from '/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyter_lsp/__init__.py'>. Instead, a `load_jupyter_server_extension` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
  loader = get_loader(loc)
[I 2025-03-31 10:40:42.406 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2025-03-31 10:40:42.406 ServerApp] jupyter_server_terminals | extension was successfully loaded.
/home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/traitlets/traitlets.py:1897: DeprecationWarning: ServerApp.token config is deprecated in jupyter-server 2.0. Use IdentityProvider.token
  return t.cast(Sentinel, self._get_trait_default_generator(names[0])(self))
[I 2025-03-31 10:40:42.408 LabApp] JupyterLab extension loaded from /home/john/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/jupyterlab
[I 2025-03-31 10:40:42.408 LabApp] JupyterLab application directory is /home/john/sage/local/var/lib/sage/venv-python3.12/share/jupyter/lab
[I 2025-03-31 10:40:42.409 LabApp] Extension Manager is 'pypi'.
[I 2025-03-31 10:40:42.444 ServerApp] jupyterlab | extension was successfully loaded.
[I 2025-03-31 10:40:42.447 ServerApp] notebook | extension was successfully loaded.
[I 2025-03-31 10:40:42.447 ServerApp] Serving notebooks from local directory: /home/john/ecnf-data/sage
[I 2025-03-31 10:40:42.447 ServerApp] Jupyter Server 2.7.3 is running at:
[I 2025-03-31 10:40:42.447 ServerApp] http://localhost:8888/tree?token=7b2e7729b2d8056cf022f4bc7673711c1845d759b220d1db
[I 2025-03-31 10:40:42.447 ServerApp]     http://127.0.0.1:8888/tree?token=7b2e7729b2d8056cf022f4bc7673711c1845d759b220d1db
[I 2025-03-31 10:40:42.447 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2025-03-31 10:40:42.470 ServerApp]
   
    To access the server, open this file in a browser:
        file:///home/john/.local/share/jupyter/runtime/jpserver-2184805-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=7b2e7729b2d8056cf022f4bc7673711c1845d759b220d1db
        http://127.0.0.1:8888/tree?token=7b2e7729b2d8056cf022f4bc7673711c1845d759b220d1db
[I 2025-03-31 10:40:42.732 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server

Dima Pasechnik

unread,
Mar 31, 2025, 9:36:05 AMMar 31
to sage-s...@googlegroups.com
What does happen if you try to open one of these URLs directly?


> [I 2025-03-31 10:40:42.732 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
>
> On Friday, 28 March 2025 at 10:48:15 UTC John Cremona wrote:
>>
>> I fixed it: looking carefully at the output led me to look at the permissions in /usr/local and I found that /usr/local/share (owbed by root) was rwxrwxrw- so it was not possible for non-root to go there. I changed it to rwxrwxr-x and now it works normally.
>>
>> Issue closed!
>>
>> John Cremona
>>
>> On Thursday, 27 March 2025 at 18:51:33 UTC John Cremona wrote:
>>>
>>> When I want to run a notebook I start sage with "sage --notebook"
>>> which used to open up a tab on my default browser (chrome) showing a
>>> list of files in the directory where I issued the command. But now it
>>> has started doing something different, namely showing a page which
>>> wants a token to be entered in a box. This is despite the URL having
>>> the token in it. And if I do paste in the correct token it responds
>>> with "invalid credentials".
>>>
>>> This is with ubuntu 24.04 and sage 10.6.rc0 (but 10.4 does the same).
>>>
>>> It may be that it used to work before I upgraded from ubuntu 22.04
>>> (and rebuilt sage after).
>>>
>>> It does work OK with firefox, though that is not what sage opens by default.
>>>
>>> John
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/980f7626-993b-4530-8b2f-4721e9439b31n%40googlegroups.com.

John Cremona

unread,
Mar 31, 2025, 10:25:32 AMMar 31
to sage-s...@googlegroups.com
Just the same -- it opens the page which asks for a token or password,
but the correct token (which is in the URL anyway) is not accepted.

This is only with chrome, firefox is fine. And it did work (in
chrome) last Friday after I fixed the permissions of /usr/local/share,
which is mysterious!

John

>
>
> > [I 2025-03-31 10:40:42.732 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
> >
> > On Friday, 28 March 2025 at 10:48:15 UTC John Cremona wrote:
> >>
> >> I fixed it: looking carefully at the output led me to look at the permissions in /usr/local and I found that /usr/local/share (owbed by root) was rwxrwxrw- so it was not possible for non-root to go there. I changed it to rwxrwxr-x and now it works normally.
> >>
> >> Issue closed!
> >>
> >> John Cremona
> >>
> >> On Thursday, 27 March 2025 at 18:51:33 UTC John Cremona wrote:
> >>>
> >>> When I want to run a notebook I start sage with "sage --notebook"
> >>> which used to open up a tab on my default browser (chrome) showing a
> >>> list of files in the directory where I issued the command. But now it
> >>> has started doing something different, namely showing a page which
> >>> wants a token to be entered in a box. This is despite the URL having
> >>> the token in it. And if I do paste in the correct token it responds
> >>> with "invalid credentials".
> >>>
> >>> This is with ubuntu 24.04 and sage 10.6.rc0 (but 10.4 does the same).
> >>>
> >>> It may be that it used to work before I upgraded from ubuntu 22.04
> >>> (and rebuilt sage after).
> >>>
> >>> It does work OK with firefox, though that is not what sage opens by default.
> >>>
> >>> John
> >
> > --
> > You received this message because you are subscribed to the Google Groups "sage-support" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> > To view this discussion visit https://groups.google.com/d/msgid/sage-support/980f7626-993b-4530-8b2f-4721e9439b31n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/ec1H4p4SIGY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/CAAWYfq167CiYpKgh5SUeWSo1UfRTz3ZHP3sSBzEeh%3DSDg%2B_RYA%40mail.gmail.com.

David Lowry-Duda

unread,
Mar 31, 2025, 11:15:32 AMMar 31
to sage-s...@googlegroups.com
On 14:24 Mon 31 Mar 2025, John Cremona wrote:
>This is only with chrome, firefox is fine. And it did work (in
>chrome) last Friday after I fixed the permissions of /usr/local/share,
>which is mysterious!

I wonder if this is a funny Chrome cache issue. Perhaps Chrome checks localstorage for some outdated token? Does Chrome work if you try to access the url from an incognito window? If so, then clearing the cache might work.

- DLD

John Cremona

unread,
Mar 31, 2025, 11:51:43 AMMar 31
to sage-s...@googlegroups.com
Thanks, DLD. I did try clearing the cache, but it made no difference.
It is probably something like that, anyway. Something that did happen
when I had notebooks running in chrome is that error messages would
pop up saying that it could not auto-save the notebook. (Obviously I
do have write permission in the directory from which I am running sage
--notebook).

But anyway, firefox works fine, and I may bother to look up how to get
sage to use it instead of chrome on my laptop (unless some kind person
who knows tells me first...)

John
> --
> You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/ec1H4p4SIGY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/Z-qxieMC4EPsSdZs%40icerm-dld.

John Cremona

unread,
Apr 1, 2025, 12:37:10 PMApr 1
to sage-s...@googlegroups.com
For what it is worth, after building 10.6 (both from scratch, and also
upgrading from a recent prerelease) chrome opens up notebooks with no
trouble. Today...

Dima Pasechnik

unread,
Apr 1, 2025, 2:10:49 PMApr 1
to sage-s...@googlegroups.com
John,
Chrome is officially a spyware, why are you complaining that it
doesn't always work as you like? :-)
You might try chromium browser instead.
Dima
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/CAD0p0K5zt6cOHSLuBg2zrieamBLPQ7hae-q1g4Wk9%2Bc-5OBX7g%40mail.gmail.com.

John Cremona

unread,
Apr 1, 2025, 4:08:42 PMApr 1
to sage-s...@googlegroups.com
Dima,

I have used both and had forgotten which is which....

(typing this in Chromium to prove that I can!)

John
> To view this discussion visit https://groups.google.com/d/msgid/sage-support/CAAWYfq3tPcfKidt3c_nvbe-DDmMXwEehwaPBrd5v8iXgCLyiEw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages