New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notebook won't save and checkpoint #1882

Closed
ultradian opened this Issue Nov 9, 2016 · 18 comments

Comments

Projects
None yet
8 participants
@ultradian
Copy link

ultradian commented Nov 9, 2016

I have recently run into a problem where suddenly I can no longer save and checkpoint my notebook. I am running on Debian 4.5.4-1~bpo8+1, with notebook server is 4.2.3 and Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]. Kernel is Julia 0.5.1-pre. Browser is Firefox 45.4. I recently installed nbextensions, and I'm not sure if activating that had anything to do with this. I am not sure what triggers this, only it seems to happen if I've left the page open overnight (only happened twice). The only way I know to save my edits is to manually copy and paste each change since the last checkpoint. Symptoms:

-when I select 'Save and Checkpoint' from the File menu, nothing happens.
-when I select 'Make a copy...' it opens a blank new tab and then nothing happens.
-if I restart the kernel, it does that, but still can't save
-If I try to close the browser window, it gives me the message:
This page is asking you to confirm that you want to leave - data you have entered may not be saved.
with the choice to stay on the page or leave. If I leave, all changes since the last checkpoint are lost.
-if I make a copy of the .ipynb file, I seem to be able to open and save it ok, but when I restart everything and open the original file, it still won't let me save and now says there are no checkpoints

what is the best and most helpful way (to you) for debugging this situation?

@takluyver

This comment has been minimized.

Copy link
Member

takluyver commented Nov 10, 2016

That's strange. When this happens, can you look to see if there's any error displayed in either the browser's Javascript console or the terminal where you started the notebook?

@ultradian

This comment has been minimized.

Copy link

ultradian commented Nov 10, 2016

There are no terminal messages besides the Kernel starting which seems normal.

Javascript did yield this error when trying to save:

TypeError: IPython.notebook.metadata.toc is undefined toc2.js:92:1

There is further code there that I can send if needed.

I also noticed looking at the Javascript console the following error when opening the notebook, although I don't know its significance:

API request failed (404): Session not found: session_id=u'23aeec95-959c-4934-93d8-1ba0178bd7a7' main.min.js:12718:9
NetworkError: A network error occurred.

There are other errors as well, but these seem to occur with other notebooks that do save correctly:

TypeError: IPython.notebook.kernel is null
Stack trace:
addSaveAsWithToc@http://localhost:8888/nbextensions/toc2/toc2.js?v=20161110110608:58:10
load_ipython_extension@http://localhost:8888/nbextensions/toc2/main.js?v=20161110110608:119:5
load_extension/</<@http://localhost:8888/static/notebook

Finally, I also noticed that under the File menu, the notebook is no longer trusted, and when I try to trust it, I get the same error:

TypeError: IPython.notebook.metadata.toc is undefined toc2.js:92:1

Is this something weird with the TOC nbextension?

@takluyver

This comment has been minimized.

Copy link
Member

takluyver commented Nov 10, 2016

That does sound like an issue with the TOC extension. @jcb91 and @jfbercher, you seem to have worked on that recently, does this sound familiar?

@jcb91

This comment has been minimized.

Copy link
Contributor

jcb91 commented Nov 10, 2016

Yes, this is probably toc2's fault.

This sounds pretty much like ipython-contrib/jupyter_contrib_nbextensions#762, and, without closer inspection, seems to originate from lines in toc assuming the existence of metadata values which for some reason don't exist. One solution is probably to patch the toc2 nbextension to create default values, in case it gets mangled somehow, although it's unclear so far how the mangling happens in the first place.

@jcb91

This comment has been minimized.

Copy link
Contributor

jcb91 commented Nov 10, 2016

@ultradian, simple check would be to disable the toc2 nbextension and see if this behaviour disappears

@jfbercher

This comment has been minimized.

Copy link

jfbercher commented Nov 11, 2016

I haven't been able to reproduce this, not the similar issue reported in ipython-contrib/jupyter_contrib_nbextensions#762. Indeed this is related to a nonexistent metadata value, though it should have been created during the extension's load. The only explanation I see is that in some very rare circumstances and for yet unknown reasons config.load fails silently.
As I said previously

It should be possible to strengthen l89-95 whith the creation of toc section, then nav_menu if both do not exist; but I would prefer to understand what happens at root.

I would still prefer to understand what happens but indeed it is possible to patch.

@jcb91

This comment has been minimized.

Copy link
Contributor

jcb91 commented Nov 11, 2016

@ultradian if you could provide a notebook which repeatably shows this behaviour, that'd be super helpful to diagnose what difficulty toc2 is actually encountering!

@ultradian

This comment has been minimized.

Copy link

ultradian commented Nov 12, 2016

OK. Here is what I found out:

When I turn off the toc2 extension, it does start to work again as you anticipated. If I save a new version, the new version seems good although the follow notices came up in the JS console:

1478916043230   addons.productaddons    ERROR   Request failed certificate checks: [Exception... "SSL is required and URI scheme is not https."  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: resource://gre/modules/CertUtils.jsm :: checkCert :: line 145"  data: no] Log.jsm:751:0
1478916043230   Toolkit.GMP ERROR   GMPWrapper(gmp-gmpopenh264) findUpdates() - updateTask for gmp-gmpopenh264 threw: [Exception... "SSL is required and URI scheme is not https."  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: resource://gre/modules/CertUtils.jsm :: checkCert :: line 145"  data: no] Stack trace: checkCert()@resource://gre/modules/CertUtils.jsm:145 < downloadXML/</success()@resource://gre/modules/addons/ProductAddonChecker.jsm:113 Log.jsm:751:0
1478916043745   addons.update-checker   WARN    Update manifest for {972ce4c6-7e08-4474-a285-3208198ce6fd} did not contain an updates property
Content Security Policy: The page's settings blocked the loading of a resource at about:blank ("base-uri https://github.com")

I still have a copy of a file that consistently gives the error TypeError: IPython.notebook.metadata.toc is undefined but it is 88 MB, and still 28MB if I zip it. Is there a good way to get it to you? I imagine it would be more helpful to figure out how I created it - maybe I had it open when installing Nbextensions? I did have some unusual problem installing it in #ipython-contrib/jupyter_contrib_nbextensions#785 that I couldn't reproduce.

@jfbercher

This comment has been minimized.

Copy link

jfbercher commented Nov 14, 2016

Hi @ultradian
Could you give a try to the update

jupyter nbextension install https://rawgit.com/jfbercher/small_nbextensions/master/toc2.zip  --user
jupyter nbextension enable toc2/main 

and report if it improves things? Look in the console if toc2 reports something about metadata. Thanks.

@ultradian

This comment has been minimized.

Copy link

ultradian commented Nov 15, 2016

It seems to fix every file so far. Did not notice any messages besides the initial [toc2] toc2 initialized (via notebook_loaded)

Thanks!

@ultradian ultradian closed this Nov 15, 2016

@takluyver takluyver added this to the no action milestone Nov 15, 2016

@jfbercher

This comment has been minimized.

Copy link

jfbercher commented Nov 15, 2016

Just for the record: this was probably due to a race condition during notebook loading. Config was loaded, processed and metadata written to the notebook before it was fully loaded (this happened of course for large notebooks). The metada were probably overwrited during notebook load and initialization data lost.

Now the extension detects that the notebook is fully loaded (or use the notebook_loaded event) before initializing itself).

@jcb91

This comment has been minimized.

Copy link
Contributor

jcb91 commented Nov 15, 2016

@jfbercher good work 👍
I thought there might be some kind of race in there somewhere haha :)
We should also add this fix to ipython-contrib/jupyter_contrib_nbextensions#762

@ultradian

This comment has been minimized.

Copy link

ultradian commented Nov 15, 2016

@jfbercher https://github.com/jfbercher Yes. Great job!

On Tue, Nov 15, 2016 at 8:35 AM, Josh Barnes notifications@github.com
wrote:

@jfbercher https://github.com/jfbercher good work 👍
I thought there might be some kind of race in there somewhere haha :)
We should also add this fix to ipython-contrib/jupyter_
contrib_nbextensions#762
ipython-contrib/jupyter_contrib_nbextensions#762


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1882 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANfHjTmZRsIzXspT1rFk6AU0I-27JLrSks5q-d9cgaJpZM4KuCUt
.

@tylertroy

This comment has been minimized.

Copy link

tylertroy commented May 7, 2018

I am experiencing the same issue but in my case it was my Ghostery Firefox extension interferring with the notebook. Even after trusting the site, this behavior did not change.

There are a couple of workarounds that I've found.

  1. Disable Ghostery for the duration of your notebook work. (not ideal)
  2. Use jupyter in another browser which does not use Ghostery.

I would welcome suggestions to properly configure Ghostery to avoid this behavior. In the mean time I'm using option 2. I changed the default browser for jupyter to Chrome, a browser I don't typically use.

Setting the default browser for Jupyter is straight forward, I went with the SO description below.

https://stackoverflow.com/questions/35229604/how-to-change-the-default-browser-used-by-the-ipython-jupyter-notebook-in-linux?rq=1

@takluyver

This comment has been minimized.

Copy link
Member

takluyver commented May 7, 2018

Oh, that's annoying. I don't know why Ghostery would interfere with it.

@harmvanderheijden

This comment has been minimized.

Copy link

harmvanderheijden commented Jun 8, 2018

I can confirm that ghostery interferes in Jupyter, in particular with write access, and that telling it to "trust this site" is not sufficient. I have not found any other workarounds than the 2 mentioned by tylertroy

@allenyllee

This comment has been minimized.

Copy link

allenyllee commented Oct 31, 2018

For me, it happens when all the cell's output is too long. Just clear some output to solve this.

@ThusithaDeepal

This comment has been minimized.

Copy link

ThusithaDeepal commented Nov 8, 2018

I had the same issue,i tried these methods unfortunately it doesn't work.
At last i found a method

  1. Copy your filename.ipynb file manully to same directory

  2. Rename it with filename at about 5 characters. Then open it in jupyter notebook , and it can be saved successfully .

  3. After that you can rename it to any name you want !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment