-
Notifications
You must be signed in to change notification settings - Fork 5k
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
JN 7.0 → Impossible to save/keep Trusted state of a notebook #6988
Comments
Thanks @MichalRIcar for reporting. Notebook 7 reuses the same trust mechanism as in JupyterLab. There were some improvements to the trust state that landed in Notebook 7: jupyterlab/jupyterlab#14025 But it looks like there are indeed some issues left. Would you be able to check with JupyterLab to see if it behaves the same? If yes we'll probably have to fix it in JupyterLab first. |
@jtpio You are right - in JupyterLab the same notebook is denoted as Trusted, however, in JN as Not Trusted. |
Hi, in JupyterLab the notebook in question is denoted as Trusted, however, the same one in JN 7 as Not Trusted. I believe it is connected with a fact that the notebook was created in older version of JN an somehow new JN has some issue with it, but doesn’t report anything anywhere. I am wondering, is there some sort of a tool which will check possible internal errors of a notebook - its structure etc. which might cause some issues in JN 7? Or only solution is to copy paste the code to newly created JN under v7? When I create a new notebook under v7 then it keeps Trusted state as expected behavior. |
Normally both JupyterLab and Notebook 7 share the same trust implementation.
Would it be possible to share a sample notebook for testing? Otherwise maybe using |
@jtpio , thank you, I will use nbformat and try to track the root of it. I will share it together with a notebook too once I will do a basic analysis. I believe during tomorrow. |
Hello, I played with the notebook in question and nbformat didn't provide me any helpful information. You can find the notebook under the link below Please let me know if there is a way to fix the Not Trusted status (except copy past cell by cell to a new notebook). Thank you |
Hi @MichalRIcar, thank you for the follow up information. This was fixed in JupyterLab 4, jupyterlab/jupyterlab#9765, and as the code is shared with Notebook 7, if it is a problem in Notebook 7, it should be appearing in JupyterLab 4 as well. |
Hello @RRosio, sadly the situation is that JL state is "Trusted", however JN state is "Not Trusted", even though when verifing JN by “jupyter trust X.ipynb” the message is “Notebook already signed: X.ipynb”, yet when I open it the state is still "Not Trusted". You can verify this behavior by the shared link above - it is somehow broken notebook - empty one but impossible to keep state Trusted → open it - change the state to Trusted - save it - close it - open it again - state in JN will be "Not Trusted"; in JL it will be "Trusted". Important note: this Jupyter Notebook behavior is only true for JN v7; JN < 7 keeps Trusted state. |
It appears that there is indeed an issue in Notebook 7: it uses the old code for indicator status which counts non-code cells in: notebook/packages/notebook-extension/src/trusted.tsx Lines 9 to 31 in 409bacc
Whereas the fix upstream changed it to only count code cells (jupyterlab/jupyterlab@ed7c879): |
So in fact there is no problem with the notebook not being trusted (this is why you see "Notebook already signed"), it is just that the label displayed is wrong. |
Opened a PR to fix this issue: |
Hello, I am playing with JN 7.0 the latest version and it is truly an amazing job, thank you for your work and effort!
The issue below is true only for JN 7, all other versions JN <7 keep Trusted state.
I just can’t figure out how to convince new JN to keep state “Trusted” - I open a notebook, change to Trusted from Not Trusted, save it. Close it and reopen it and state is again “Not Trusted”.
I tried it on several machines and notebooks and no luck - always falls back to Not Trusted.
Even “jupyter trust X.ipynb” command doesn’t solve the problem - it reports back “Notebook already signed: X.ipynb”. However, once opened it is in the Not Trusted state.
Can you guide me how to fix it?
Note:
The only possible link to this issue I see is a server’s message:
“This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: Issue 1666807: Incorrect file path reported by inspect.getabsfile() - Python tracker”
But as previous versions of Jupyter didn’t have this message, I have no clue how to fix it.
Thanks,
Michal
The text was updated successfully, but these errors were encountered: