JupyterLab browser crashed... where are my files?

I’ve been building a probability model with data in jupyterLab and I get up to open the fence outside for grocery delivery and I come back to find the browser crashed. It was saved as untitled.ipynb but where are those files?

I don’t know where these things are saved or the file path for safari web-browser and its due in three hours, so am I hosed because I didn’t write this from within PyCharm like I always do or can browser based jupyterlab notebook data be recovered ?

So I’ve created a new file, saved it and the path for it is Jupyter Notebook but that doesn’t help me recover the old one.

I even went in to look for my files among the workspace folder, its just a bunch of nested dictionaries with filepaths.

So note to the wise, jupyter notebook does not have any autosave function or location. Solution? Could I write an autosave function for jupyter notebooks?

JupyterLab does have:

  • an autosave function which is enabled by default (running in 120 seconds intervals, but customizable in Document Manager settings under autosaveInterval)
  • checkpoints feature which creates a backup for your most recent notebook (those are stored in .ipynb_checkpoints directories)
  • can be started in / pointed to any directory, so location of your notebook depends entirely on how you started JupyterLab.

However based on the fact that you provided an URL to a Binder, it seems that you have not installed JupyterLab locally as described in the documentation: Installation — JupyterLab 3.3.0a1 documentation

but instead you opened a temporary deployment of Binder (Binder Documentation — Binder 0.1b documentation). Binder is here to fill several objectives:

  • for tutorials so that participants do not need to set up a local installation
  • enabling researchers to demo their repository contents for published papers in an interactive environment
  • allowing developers and active users to check new versions of JupyterLab in the browser

etc. The primary goal of Binder does NOT include performing heavy, or production-focused work; this is a community service which costs money to run and it is meant to facilitate exchange of ideas, quick demos, etc rather than be used as a substitute of your own computing resources. This is in part why Binder does not offer a permanent storage (someone would need to pay for this, and as Project Jupyter is non for profit <which in practical terms means that it does not charge for software and services and it does not sell your data, as compared to other options out there> someone would need to fund this, secure it, and guard this against use by malicious actors).

So if you ask “Can I recover data from expired Binder” (which is by definition a temporary environment) the answer is no. However, your wording “can browser based jupyterlab notebook data be recovered” is ambiguous: standard JupyterLab installation is based on interaction via browser too. Moreover there is JupyterLite which is a fully browser-based solution which stores data in your browser.

PS. There are however third-party deployments which offer JupyterLab in the browser which are free (or “free” - whatever) and do offer permanent storage. Amazon SageMaker Studio Lab is one such a service (I did not use it but read positive opinions on this one).

1 Like

There is also available in most (not all) MyBinder-backed sessions an opt-in option to save noteboks along the way to your local browser cache. Had you done that along the way, you may have been able to restore from there? Maybe??? I’m unsure as I try not to rely on it. And it is best tested well in advance of a crisis.
See Getting your notebook after your Binder has stopped.

In case it looks like it isn’t included by default in the older notes about it (or the notes about it don’t show JupyterLab examples), I’ll clarify. Originally, you had to add the extension in to the configuration files for your repo; however, now this ‘safety net’ system is included by default in typical MyBinder.org-served sessions without the need to specify anything in your configuration files. (Those backed by Dockerfiles, which are not recommended, don’t include this though at this time.) It is available in both the classic notebook interface and in JupyterLab in launches from typical MyBinder-ready repos.

2 Likes