jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.74k stars 4.99k forks source link

Autosave not working #7517

Open kylekehrer opened 1 week ago

kylekehrer commented 1 week ago

Description

Hello, I recently switched over from PC to Mac and have installed jupyter notebook as my primary python coding environment. It's working great so far, except that the files no longer autosave as expected. There are no error messages in the terminal I open Jupyter notebook from, and so far the only hint to the issue is that when I try to run %autosave 120 (for example) in one of the cells, I receive the error message

Javascript Error: IPython is not defined Autosaving every 120 seconds

No matter the time I pass as an argument to %autosave, it will never autosave at that frequency. I've tried searching this problem online, which included possible fixes as deleting ~/.ipynb_checkpoints, running jupyter notebook as root, and explicitly adding ~.ipynb_checkpoints to the jupyter notebook config file as the place to store checkpoints, but nothing has worked. I can cmd+S to save the files just fine, but it would be nice to have the autosave feature working in case I forget when I close a notebook.

Reproduce

  1. Go to terminal and type jupyter notebook
  2. Click on or create any .ipynb file
  3. Observe top of window
  4. Notice that it never autosaves/creates a checkpoint on its own, and no error message appears

Expected behavior

Context

Troubleshoot Output
$PATH:
    /Library/Frameworks/Python.framework/Versions/3.13/bin
    /usr/local/bin
    /System/Cryptexes/App/usr/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

sys.path:
    /Library/Frameworks/Python.framework/Versions/3.13/bin
    /Library/Frameworks/Python.framework/Versions/3.13/lib/python313.zip
    /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13
    /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dynload
    /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages

sys.executable:
    /Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13

sys.version:
    3.13.0 (v3.13.0:60403a5409f, Oct  7 2024, 00:37:40) [Clang 15.0.0 (clang-1500.3.9.4)]

platform.platform():
    macOS-15.1-arm64-arm-64bit-Mach-O

which -a jupyter:
    /Library/Frameworks/Python.framework/Versions/3.13/bin/jupyter

pip list:
    Package                   Version
    ------------------------- --------------
    anyio                     4.6.2.post1
    appnope                   0.1.4
    argon2-cffi               23.1.0
    argon2-cffi-bindings      21.2.0
    arrow                     1.3.0
    asttokens                 2.4.1
    async-lru                 2.0.4
    attrs                     24.2.0
    babel                     2.16.0
    beautifulsoup4            4.12.3
    bleach                    6.2.0
    certifi                   2024.8.30
    cffi                      1.17.1
    charset-normalizer        3.4.0
    comm                      0.2.2
    contourpy                 1.3.0
    cycler                    0.12.1
    debugpy                   1.8.7
    decorator                 5.1.1
    defusedxml                0.7.1
    executing                 2.1.0
    fastjsonschema            2.20.0
    fonttools                 4.54.1
    fqdn                      1.5.1
    h11                       0.14.0
    httpcore                  1.0.6
    httpx                     0.27.2
    idna                      3.10
    ipykernel                 6.29.5
    ipympl                    0.9.4
    ipython                   8.29.0
    ipython-genutils          0.2.0
    ipywidgets                8.1.5
    isoduration               20.11.0
    jedi                      0.19.1
    Jinja2                    3.1.4
    json5                     0.9.25
    jsonpointer               3.0.0
    jsonschema                4.23.0
    jsonschema-specifications 2024.10.1
    jupyter_client            8.6.3
    jupyter_core              5.7.2
    jupyter-events            0.10.0
    jupyter-lsp               2.2.5
    jupyter_server            2.14.2
    jupyter_server_terminals  0.5.3
    jupyterlab                4.2.5
    jupyterlab_pygments       0.3.0
    jupyterlab_server         2.27.3
    jupyterlab_widgets        3.0.13
    kiwisolver                1.4.7
    MarkupSafe                3.0.2
    matplotlib                3.9.2
    matplotlib-inline         0.1.7
    matplotlib-label-lines    0.7.0
    mistune                   3.0.2
    more-itertools            10.5.0
    nbclient                  0.10.0
    nbconvert                 7.16.4
    nbformat                  5.10.4
    nest-asyncio              1.6.0
    notebook                  7.2.2
    notebook_shim             0.2.4
    numpy                     2.1.3
    overrides                 7.7.0
    packaging                 24.1
    pandocfilters             1.5.1
    parso                     0.8.4
    pexpect                   4.9.0
    pillow                    11.0.0
    pip                       24.3.1
    platformdirs              4.3.6
    prometheus_client         0.21.0
    prompt_toolkit            3.0.48
    psutil                    6.1.0
    ptyprocess                0.7.0
    pure_eval                 0.2.3
    pycparser                 2.22
    Pygments                  2.18.0
    pyparsing                 3.2.0
    python-dateutil           2.9.0.post0
    python-json-logger        2.0.7
    PyYAML                    6.0.2
    pyzmq                     26.2.0
    referencing               0.35.1
    requests                  2.32.3
    rfc3339-validator         0.1.4
    rfc3986-validator         0.1.1
    rpds-py                   0.20.1
    scipy                     1.14.1
    Send2Trash                1.8.3
    setuptools                75.3.0
    six                       1.16.0
    sniffio                   1.3.1
    soupsieve                 2.6
    stack-data                0.6.3
    terminado                 0.18.1
    tinycss2                  1.4.0
    tornado                   6.4.1
    traitlets                 5.14.3
    types-python-dateutil     2.9.0.20241003
    uri-template              1.3.0
    urllib3                   2.2.3
    wcwidth                   0.2.13
    webcolors                 24.8.0
    webencodings              0.5.1
    websocket-client          1.8.0
    widgetsnbextension        4.0.13
Command Line Output
[I 2024-11-06 16:34:58.379 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-11-06 16:34:58.380 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-11-06 16:34:58.381 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-11-06 16:34:58.383 ServerApp] notebook | extension was successfully linked.
[I 2024-11-06 16:34:58.502 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-11-06 16:34:58.518 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-11-06 16:34:58.519 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-11-06 16:34:58.520 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-11-06 16:34:58.520 LabApp] JupyterLab extension loaded from /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/jupyterlab
[I 2024-11-06 16:34:58.520 LabApp] JupyterLab application directory is /Library/Frameworks/Python.framework/Versions/3.13/share/jupyter/lab
[I 2024-11-06 16:34:58.521 LabApp] Extension Manager is 'pypi'.
[I 2024-11-06 16:34:58.535 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-11-06 16:34:58.536 ServerApp] notebook | extension was successfully loaded.
[I 2024-11-06 16:34:58.537 ServerApp] Serving notebooks from local directory: /Users/kkehrer
[I 2024-11-06 16:34:58.537 ServerApp] Jupyter Server 2.14.2 is running at:
[I 2024-11-06 16:34:58.537 ServerApp] http://localhost:8888/tree
[I 2024-11-06 16:34:58.537 ServerApp]     http://127.0.0.1:8888/tree
[I 2024-11-06 16:34:58.537 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2024-11-06 16:34:58.546 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
Browser Output
Menu entry for command 'filemenu:close-and-cleanup' is duplicated. [5649.bundle.js:1:14277](http://localhost:8888/static/notebook/5649.bundle.js)
Menu entry for command 'application:close' is duplicated. [5649.bundle.js:1:14277](http://localhost:8888/static/notebook/5649.bundle.js)
can't convert undefined to object [8471.bundle.js:1:13976](http://localhost:8888/static/notebook/8471.bundle.js)
Settings failed to load for (@jupyterlab/application-extension:context-menu) 
Array [ {…} ]
[5099.bundle.js:1:16794](http://localhost:8888/static/notebook/5099.bundle.js)
Settings failed to load for (@jupyterlab/application-extension:context-menu) 
Array [ {…} ]
[3768.bundle.js:1:4113](http://localhost:8888/static/notebook/3768.bundle.js)
Settings failed to load for (@jupyterlab/metadataform-extension:metadataforms) 
Array [ {…} ]
[3768.bundle.js:1:4113](http://localhost:8888/static/notebook/3768.bundle.js)
Settings failed to load for (@jupyterlab/cell-toolbar-extension:plugin) 
Array [ {…} ]
[3768.bundle.js:1:4113](http://localhost:8888/static/notebook/3768.bundle.js)

RRosio commented 1 day ago

Thank you for opening this issue @kylekehrer! The Autosave interval option is available in the settings editor so you could try setting it there (search for autosave in the Settings Editor to find the option). You can find more information on the error you are receiving in the following issue: https://github.com/jupyterlab/jupyterlab/issues/5660