Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Notebook didn't save for over a day. How can I recover lost work?

I've lost a day's work in Jupyter Notebook because it didn't autosave. As I was working, I would click on File > Save and Checkpoint to be safe. I closed the notebook when I finished working and when I tried reopening it, I see that essentially all my work is gone and it says Last Checkpoint: a day ago (autosaved) next to the filename. I now realize that I had been working for a long time on the notebook with an orange box with some kind of error message. I'm sorry that I can't remember the specific message right now, but I think it was something involving POS or POST or POSIT ...?. I saw Trusted next to the error message, so I must've thought things were OK.

I tried opening the filename-checkpoint.ipynb file within the .ipynb_checkpoints folder but it's blank. I looked up a possible solution on Recovering from a Jupyter Disaster, but it requires SQL, which I don't know. Is there any hope for recovering my work? I realize that this is probably a rookie mistake, but I'm pretty new at this.

Thanks

PS: I'm running Python3 on MacOS

like image 579
Data2Dollars Avatar asked Nov 11 '19 01:11

Data2Dollars


People also ask

Does jupyter notebook have autosave?

Jupyter Notebooks autosave, so you don't have to worry about losing code too much. At the top of the page you can usually see the current save status: Last Checkpoint: 2 minutes ago (unsaved changes)

How do I recover a deleted Jupyter cell?

You can recover a deleted cell in a jupyter notebook with the Edit menu. Go to Edit -> Undo Delete Cells to undo the delete operation performed on the cells and recover back your deleted cell.


2 Answers

Hope you've already found how to recover lost work from Jupyter notebook work. If not, try the following:

  • Go to Anaconda Navigator (the green circle!)
  • Launch a Jupyter Lab
  • In Jupyter Lab, open a Terminal window
  • Launch iPython in the terminal by typing ipython and hitting enter
  • Hit Up arrow
  • All your codes are stored in history and each cell compilation that you would've done in the past shows up there.
  • Copy+Paste it back to a new Jupyter notebook and you are ready to go again!
like image 140
user3792245 Avatar answered Sep 18 '22 01:09

user3792245


If you want to copy/paste.
After running terminal and ipython, page_up yo code you want. Click right button on a mouse, then Watch the elements code. Now you can select code, copy and paste it.

like image 30
FoxRes Avatar answered Sep 20 '22 01:09

FoxRes