Repare jupyter Notebook - jupyter-notebook

Is there a way to repare a jupyter notebook. I can't open the notebook anymore.
I am having the following error when trying to open it.
Unreadable Notebook: path/to/notebook.ipynb UnicodeDecodeError('utf-8', b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x15\x18\x00\x00\x0e\x10\x08\x06\x00\x00\x00\x83\xba\xacA\x00\x00\x009tEXtSoftware\x00Matplotlib version3.3.3,
....
invalid start byte'
The same error happens when opening the notebook in lab or notebook.
Other notebooks open without problem.

Related

Unreadable Notebook: NotADirectoryError(20, 'The directory name is invalid')

I created a Jupyter notebook inside a virtualenv environment and worked fine in the first session. However, when I tried to open the notebook again, I got the error titled Error loading notebook saying Unreadable Notebook: 'Path' NotADirectoryError(20, 'The directory name is invalid'), where 'Path' is just the local path of the notebook.
I'm able to open the notebook using Colab and it works fine. Also, it is saved inside a folder that is synced by Google Drive.
How can I open my notebook with Jupyter again?
A print screen of the error:
Thanks
I have tried reinstalling Jupyter Notebook, but the error persists.

Prevent jupyter console from reading code from jupyter notebook

When on jupyter console and I hit the up arrow key, I'd like to go to the previously run line of code on that console. However it will read a previously run cell from a jupyter notebook instead. Is there a way to prevent this from happening?

Running Jupyter notebook (and generating plots) from the command line

I'm trying to use the terminal to run a jupyter notebook (kernel: Julia v1.6.2), which contains generated using Plots.jl, before uploading the notebook to github for viewing on nbviewer.com.
Following this question:
How to run an .ipynb Jupyter Notebook from terminal?
I have been using nbconvert as follows:
jupyter nbconvert --execute --to notebook --inplace
This runs the notebook (if you tweak the timeout limits), however, it does not display plots when using Plots.jl, even when I explicitly call display(plot()) at the end of a cell.
Does anyone have any idea how notebooks can be run remotely in such a manner that plots will be generated and displayed, particularly when using Julia?
I managed to generate Plots.jl plots by getting from IJulia the same configuration it uses to run notebooks (this is probably the most sure way when you have many Pyhtons etc.).
using Conda, IJulia
Conda.add("nbconvert") # I made sure nbconvert is installed
mycmd = IJulia.find_jupyter_subcommand("nbconvert")
append!(mycmd.exec, ["--ExecutePreprocessor.timeout=600","--to", "notebook" ,"--execute", "note1.ipynb"])
Now mycmd has exactly the same environment as seen by IJulia so we can do run(mycmd):
julia> run(mycmd)
[NbConvertApp] Converting notebook note1.ipynb to notebook
Starting kernel event loops.
[NbConvertApp] Writing 23722 bytes to note1.nbconvert.ipynb
The outcome got saved to note1.nbconvert.ipynb, I open it with nteract to show that graphs actually got generated:
Launch notebook with using IJulia and notebook() in the REPL

Problems about open .ipynb file incorrectly in PycharmI

I want use jupyter notebook in Pycharm,but when I open .ipynb file,it show as I show

Nothing shows up when i run Jupyter notebook

When i run jupyter notebook it just shows up blank
I checked Console for errors and it showed me this:
Console error message
This is the line that the above Error message is referring to:
Error message line
Here is the URL bar if you need it (this is what the URL bar shows when i launch Jupyter notebook):
URL
used
jupyter nbconvert --to script object_detection_tutorial.ipynb
to convert .ipynb to .txt, then copied the code to a .py file

Resources