Is there a way to disable saving to checkpoints for Jupyter Notebooks?

可紊 提交于 2020-12-02 06:54:43

问题


I am working in an environment where writing to the disk space with a folder name like .ipynb_checkpoints is disallowed.

Unfortunately, this is Jupyter Notebook's default path for Save and Checkpoint. Is there a way to configure Jupyter Notebook to not use the checkpoint feature or allow a different folder name?


回答1:


Not exactly an answer to your question, but perhaps close enough.

The path of the checkpoints folder is configurable so you could rename it to something allowed such as "_ipynb_checkpoints", or you could move it to a completely different folder.

You simply have to add

c.FileCheckpoints.checkpoint_dir = '_ipynb_checkpoints'

to jupyter_notebook_config.py




回答2:


There are couple of ways to stop autosaves.

There is a contrib nbextension called AutoSaveTime if you have installed jupyter-contrib-nbextensions that adds an autosave time configuration on the toolbar of a notebook, just ensure:

"autosavetime/main": true

is set in your notebook.json configuration file.

Alternatively in a Cell, to change the autosave value for the current notebook, you can write:

%autosave 0

Or you can change your custom.js to make this permanent for all notebooks:

define([
    'base/js/namespace',
    'base/js/events'
    ],
    function(IPython, events) {
        events.on("notebook_loaded.Notebook",
            function () {
                IPython.notebook.set_autosave_interval(0);
            }
        );
    }
);


来源:https://stackoverflow.com/questions/51887758/is-there-a-way-to-disable-saving-to-checkpoints-for-jupyter-notebooks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!