jupyter notebook display cells horizontal - ipython

I have issues on jupyter notebook conversion. It looks fine on jupyter notebook. However if I convert it to html or upload to github, it displays like photo above.
Instead of vertical(scroll up and down), I have to scroll left and right and each cell are really narrowed.
Any suggestion?
Thanks in advance!

This is typical of a library you use emitting invalid HTML. I would suggest opening an issue or contacting the Jupyter mailing list to help you debug this as StackOverflow will not be the right place to have a back and forth.
You should be able to narrow down which library does that by:
- backup your notebook.
- Delete cells one and until notebook looks normal. (tip use nbconvert locally instead of uploading, and use python -m http.server)
- the last cell you delete have a issue.
It may be a bug in nbconvert but I doubt it.

Related

What is Jupyter cell tag in VSCode?

I've googled a bit but everything points to the Jupyter notebook, not vscode and was just wondering if there are any resources available on how to use these cell tags in VSCode. Simply copying a tag in doesnt seem to do anything in my notebook.
So basically 2 questions:
How do you use this tab?
What do cell tags do?

Highlighting problem in Jupyter Notebook - VSCode

Lately when using Jupyter Notebook in VS Code to write some assignments for my studies I ran into a quite annoying problem - whenever there is a mistake in my code cell that prevents it from running, the "traceback" (or however you call it) to the place where the error persists is colored with a high-contrast marker (the color depends on the theme used) and makes the content pretty much invisible unless you manually "select" it with the mouse coursor. Is there any way I could fix it without going too much in-depth into VSCode/Jupyter Notebook extension settings?
The highlighting looks like shown below.
Yellow syntax marker problem.
And another one here.
I tried all the themes preinstalled with VS Code such as Monokai, Solarized Light etc., and also a custom theme of my choice called Dracula.
Thanks in advance.
This issue has recently reappeared. While the issue is being fixed you can change the highlight colour within the vscode settings.
Open settings and search for "Workbench:ColorCustomizations"
Image of settings page
Create or alter the "terminal.ansiYellow": "#eed202" to a more appropriate value like "terminal.ansiYellow": "#9b4550". See the linked image.
Credit for this fix: https://github.com/microsoft/vscode-jupyter/issues/8717#issuecomment-1241776226
I also have this problem. It looks like they fixed it less than 1 month ago as of writing this, so it may go away if you update to a recent pre-release of Jupyter in VS Code. Personally, I am going to live with it until the next stable release.
My version of Jupyter in VS Code:
Screenshot of Jupyter Versions
Screenshot of vscode-jupyter github: Screenshot of vscode-jupyter github
https://github.com/microsoft/vscode-jupyter/issues/8697

Display cell scrollbar in Jupyter Notebook on GitHub

A cell output in one of my Jupyter notebooks has a vertical scrollable side bar. When I added this notebook to my GitHub repository, the full output (which takes up a lot of space) was displayed. Is it possible for GitHub to display the cell output with a sidebar?
Below is a minimal working example illustrating the problem. Here is a screenshot of a cell in a Jupyter Notebook that has a scrollbar:
If this notebook is converted to HTML via jupyter nbconvert --to html name.ipynb and viewed in a browser (to replicate publishing and viewing the notebook on GitHub), then the output looks like this (there is no scrollbar):
I found the following related links, but no one has posted a solution yet:
How to get a vertical scrollbar in HTML output from Jupyter notebooks
How to add a vertical scrollbar in html output from jupyter notebook with nbconvert?
Any help would be appreciated!

Notebook validation failed: Non-unique cell id 'hawaiian-pregnancy' detected. Corrected to '8fbbc816'.:

i have copied the notebook to create another version and all the time getting this strange errors, Does anyone have a clue how to get rid of it?
i have solved it with clicking "Trust" in jupyter notebook on the tool panel.
The best temporary solution so far is the following, from this GitHub issue:
First select all the cells in the Jupyter Notebook, then press the "cut/scissors" button (don't panic, at this point your Notebook will be empty), and finally press the "paste" button.

keep cell metadata in a copy of a jupyter notebook?

I'm working on a jupyter notebook (from a local installation of jupyterhub) that I want to be able to copy and distribute to my coworkers. Some of them are a little 'code-phobic' so I want to be able to portions of the code from them.
I can use the hide input extension to very prettily hide the code in my own notebook, however when I make a copy the cell meta-data for hide input reverts to "hide_input": false, and the code is all automatically visible.
Is there a way to keep cell meta data in the copying process?
I can find a lot of online discussions/documentation about keeping hide input functionality with nbconvert, however I don't want to convert to html because I still need the users to be able to actually run code.
Is there a way to use nbconvert to make a copy of a notebook and not actually convert it?
Thanks.
I'm confused - because for me cell metadata is preserved when copied. Are you sure you are actually saving the notebook after you have changed the cell metadata?
Regardless, you can use nbconvert to "convert" a notebook into a notebook; use the command:
jupyter nbconvert --to notebook --execute mynotebook.ipynb
From the docs: https://nbconvert.readthedocs.io/en/latest/usage.html#notebook-and-preprocessors
If you use the Toggle selected cell input button or individually edit cell metadata the individual cell hide input status was not preserved. But when I used the Hide codecell inputs to hide the input of all the cells; then it was preserved after copying.