Where does Jupyter Notebook save files? - jupyter-notebook

So I'm just beginning my programming/coding journey. I've downloaded Anaconda and made a shortcut for Jupyter Notebook on my desktop. I tried using my first file the other day, and I'm not sure where it's being saved to. Also, I basically don't want Jupyter to save any Notebook I do once I close the Notebook, unless I specifically save it myself - I just use it for 'working out' if you like.
Here is the image showing what I mean
Like, where is that untitled.ipynb file being saved? And, how can I adjust my settings in Jupyter Notebook such that these files aren't saved and are discarded automatically so I can use them as I describe just for 'working out'?

By default the ipynb files are stored to your user profile:
C:\Users\yourlogin
How to disable autosave has already been described here:
Turn Off Autosave in IPython Notebook
I don't recommend doing that.

Related

How do I force Jupyter Lab to revert a file

I have a Jupyter Notebook open in Jupyter Lab. I run black to reformat the code in the open Jupyter Notebook. If I try to save the file, Jupyter Lab raises
"notebook.ipynb" has changed on disk since the last time it was opened
or saved. Do you want to overwrite the file on disk with the version
open here, or load the version on disk (revert)?
How can I revert the Jupyter Notebook without try to save it?
I found the answer at File > Reload from Disk.

How can i edit jupyter notebook from terminal without opening web browser?

How can I edit my jupyter notebook in terminal.
I just don't like to open jupyter notebook in web browser.
I google out but every answer is related to how can we open notebook from terminal directly.
I'd suggest looking at Jupytext's ability to do command line conversions back-and-forth from the notebook json structure to a python script (or markdown). If you already have the backbone of a notebook (.ipynb) file, you can convert it to .py script using jupytext --to py notebook.ipynb. That makes a text file that is easy to edit in your favorite terminal based text editor. The json in the .ipynb files is not as easy to edit directly.
Then when you are done editing, you can convert the .py script form back to a notebook with something like jupytext --to notebook notebook.py. Optionally, you can even execute it without opening a browser by adding --execute. I have an example conversion-and-execution command in use here.

How do I set the save location of a session in Jupyter notebook?

I'm working with Jupyter Notebook version 4.1.0 and can't seem to manually select the save path.
How does one manually specify where a session is saved?
You can launch jupyter notebook from the command line from inside the desired folder path. This will set the current folder as the start of the directory tree in Jupyter.
If we already have a session running, we can select the option IPython Notebook (.ipynb), from the file menu, under the Download as option. After saving the Notebook to a desired path, we can open it using the method described above.

Use workspace of an RStudio session in Jupyter notebook

As my RAM is scarce, I'd like to not replicate data and use objects created in an RStudio session inside my Jupyter notebook (running w/ R kernel).
Any idea how to do it?
Basically I'd like to use the same workspace in both, the RStudio and the Jupyter notebook session.
Thanks for help!
One problem I encountered with an R notebook in Jupyter, though, was saving my workspace. In a normal R session I’m used to saving my workspace at the end of the session and coming back to it later to pick up where I left off. However, with the Jupyter notebook I found that I had to rerun all the code to regenerate all the objects again! This appears to be an issue for Python notebook users too.
There’s a very simple fix for this: Just run the standard R command
save.image()
Your workspace will then be saved to the usual hidden .RData file in the same folder as the Jupyter notebook. If you want to share the code and the workspace, you’ll have to make sure that you copy both the notebook file and the .RData file that goes along with it.
Likewise, if you start a notebook in a folder that already has an .RData file, you’ll find that you can access that workspace from the Jupyter notebook – just run ls() to see what’s there.

IPython Notebook: Save the currently running notebook as ipynb file using a python command in a cell?

Is there are a way to save the Ipython notebook as an ipynb file from a cell within that notebook?
I know I can save it at any time by manually pressing "CTRL-M S", but I would like to use a command in a cell to do so (python command or %magic).
In this way I could "Run all cells" and be sure that the output (e.g. inline figures) is saved into the notebookfile when the execution is finished.
Update: Current versions of the Jupyter notebook (the successor of the IPython notebook) autosave into a hidden folder every few minutes (This feature was in development when I asked the question - see accepted answer).
No, because the kernel does not know it is accessed from a notebook. Dev version have auto-save feature though, and you could write a javascript extension that listen for cell execution event. But Python is not the way to do it. (or display(Javascript('js-code-to-save-notebook')) in the last cell, but I did not tell you)

Resources