cant acces jupyter notebook variable from previous session - jupyter-notebook

So, im playing around with jupyter notebook, and I have this code, that i wrote yesterday:
BUt the problem is, that when i try to acces my model object the next day. Jupyter does not allow me to do that
For some reason i am not able to acces the variables in cells that i wrote i a previous session. Why is this? and how do I circumvent?

If you shut down the Jupyter Notebook service this is to be expected. Your output and cell numbers are saved in the notebook, but objects actually do not stay in memory. Notice how you have In [4]: in both screenshots. This is because you restarted the service and the second screenshot shows your 4th run of that cell since the restart.
You need to rerun the entire notebook to load everything into memory. You can use Kernel> Restart & Run All from the top menu to do this automatically.

Related

'_xsrf' argument missing from POST - Need a Permanent Fix - Other Suggested Solutions are Not Working

Every time I open Jupyter Lab from Anaconda, I receive the following error: '_xsrf' argument missing from POST.
I am using Google Chrome on Windows 10.
I've followed the suggestions from the other posts, e.g. copy and paste the URL into different Chrome tab and refresh the page.
It seems like my sessions are not properly closing, even if I terminate all kernels for that specific session.
I've closed all Jupyter Lab sessions by using jupyter notebook stop <session_number>. Nothing has changed.
Someone has suggested revising the configuration. However, I am unclear as to what problems a reconfiguration will cause downstream.
One last thing, I do NOT encounter this problem when running Jupyter Notebook. The error only occurs when I open Jupyter Lab.

close Google Chrome accidentally and variables in jupyter notebook are missed

I accidentally closed Google Chrome while running jupyter notebook, and when I restart jupyter notebook again, the variables I got from my previous run are gone, what should I do?
Unfortunately the variables are not saved when you close instances of Jupyter notebook. They are gone. The code is saved automatically every now and then (or manually when you do it yourself). But if that hasn't happened in a while, you'll need to rerun the code to re-generate the variables.

Reconnecting to jupyter notebook loses output

I have a remote server with a long-running jupyter notebook process (keras training).
When I reconnect to the notebook (either by reloading the chrome tab or by clicking on the notebook in the list of running notebooks), I get a tab marked as "running" (hourglass icon instead of the book icon), and I can confirm that the process is running by ssh to the server.
However, the progress indicator and stdout of the process running is lost. The bar
71255/225127 [========>.....................] - ETA: 3:32:43 - loss: 2.1890
is never updated. Other (non-keras) processes lose their stdout (unless I also write to a file).
Is this a known problem?
Is there a way to recover the output stream after reconnecting?
This is a known problem, and as far as I know IPython has already published a collaboration jupyter notebook option, that they said "could solve the problem in the collaboration mode"
Sadly, if it's lost, there's no way to find it back (unless you outputted to a file or to a variable, or you know how to do some intricate tricks that could recover the data)
One way to solve this, to prevent the issue in advance, is to use magic code
%%capture <VARIABLE NAME> in the cell you want to save the stdout when closed the notebook in your browser (don't terminate your notebook). In this way, output will be save in <VARIABLE NAME> and later on you can access it using print(<VARIABLE NAME>.stdout), after the process is finished.

Impossibily to run Jupyter notebook from Windows start menu and required tokens

I am a novice in the use of Python and I am using PandasBiogeme to estimate discrete choice models.
My issue is related to the Jupyter notebook. Usually when I wish to use it, I select it from the start menu of Windows 7 and automatically a new tab opens up in Chrome.
Yesterday, actually by not knowing exactly why, I logged out from Jupyter notebook and today when I launched it from the start menu the following error message appeared:
I thus decided to reinstall Anaconda, and PandasBiogeme and to update both of them.
Now when I wish to open Jupyter notebook from the start menu a prompt menu appears and suddenly disappears. Therefore I need to open the Anaconda Powershell and type
jupyter notebook
Yet, when I do this I receive the same error message I reported above
I typed in the second URL and I was then able to work again.
Yet, when I close Jupyter notebook and try to launch it again the same problem arises and I have to insert again 'a' token. I wrote 'a' token, because if I select by chance the token reported at the following URL (which has nothing to do with my work)
https://jupyter-notebook.readthedocs.io/en/stable/security.html
namely, this one:
http://localhost:8888/?token=c8de56fa4deed24899803e93c227592aef6538f93025fe01
and then Jupyter notebook works and I can carry out my estimation.
I read different posts on the possibility to set a password to avoid problems related to tokens, but only the first time I inserted the token I had the option to insert a password in in a html page, but I decided not to do it. Now I believe it could be the case.
This is something that happened overnight, without, I believe, my doing anything specifically.
This issue is driving me crazy and I would be thankful if any of you had a potential suggestion.
Many thanks.
Marco

ipython notebook hang when open a large notebook

I am using the LATEST (2.2.0) ipython notebook, when I create a notebook with a loop to write many lines (about 20000 lines), then it run forever I guess since I always see the running icon at the top right. Even if I restart the computer and reopen the notebook again, it will into a running mode automatically, then I almost unable to do anything in this page. I have to copy the code and new another page to fix it.
How can I fix such hang issue during open a too large notebook? I have tried the kernel "interrupt" and "restart" menu and it seems no any effect at all.
IPython notebook is not intended to do such tasks with too much calculation or too many output data because actually such things is for standalone program rather than a notebook.
To fix such issues, you need to create a standalone application (script) to do it from console, then paste the meaningful result into IPython notebook.

Resources