How to get github to show my jupyter notebook images? - github

Github is not showing the images in my jupyter notebook.
I have tried pushing different formats such as:
![alt text](img/file.png)
and
<img src="img/file.png", width=200, height=200>
which they do work on my local jupyter notebooks in regards of showing images, but once I pushed these notebooks to Github, everything works fine in my repository, but the images won't show.
here is an example

As mentioned in my comment, when something like this happens please ensure that you are uploading the relevant files and that the path you are uploading the files to is still valid relative to the notebook.

Related

The notebook I saved to Github from Kaggle comes out as one long line of code instead of formatting. How can I fix this?

I am trying to save my notebook on Kaggle to my GitHub repository. However, when I go to GitHub the notebook isn't formatted and is just a long line of illegible code. Is this because my notebook has markdowns and code? I tried to follow the steps to get it from Kaggle to GitHub but I am not sure what I am doing wrong.
Here is the start of my notebook on kaggle, then what it looks like in my GitHub repository.
Kaggle
Github

Link from One GitHub Jupyter Notebook to Another in the Same Repo

Is there any way that I can locally link from one Jupyter notebook to another on GitHub without the need to embed the absolute path, such as https://github.com/jeffheaton/test-linking/blob/main/notebook1.ipynb?
I create a notebook (notebook1.ipynb)
With this content:
# This is Notebook 1
* [Link to Notebook 2a](notebook2.ipynb)
* [Link to Notebook 2b](./notebook2.ipynb))
I tried two different methods, one using the . for current directory. Neither worked.
notebook2.ipynb is actually at this URL:
https://github.com/jeffheaton/test-linking/blob/main/notebook2.ipynb
However, GitHub transforms my link into:
https://notebooks.githubusercontent.com/view/notebook2.ipynb
Which results in a bad link.
If I put this same markdown into README.md it works fine. Just does not seem to like jupyter notebooks.
I would really like to NOT have to prefix everything with https://github.com/jeffheaton/test-linking/blob/main/, because the local links:
Work locally, outside of GitHub
On GitHub are branch agnostic
You can see my attempts to make this work at this short repo: https://github.com/jeffheaton/test-linking
In case anyone happens upon this question. GitHub resolved this issue, relative links now appear to work just fine.

Install Jupyter Notebook extensions on copy hosted on cloned Github Repository?

I have a cloned Jupyter Notebook hosted on Github. Locally, I have installed Jupyter Notebook extensions but these are not maintained within the Github environment.
Is there a way to install the extensions on the Github server so that cells can be toggled on/off with notebook extensions? Or will I have to go with a Javascript hack as per https://gist.github.com/Zsailer/5d1f4e357c78409dd9a5a4e5c61be552?
It appears this cant' be done as per below:
When you add Jupyter Notebook or IPython Notebook files with a .ipynb extension on GitHub, they will render as static HTML files in your repository.
The interactive features of the notebook, such as custom JavaScript plots, will not work in your repository on GitHub. For an example, see Linking and Interactions.ipynb.
To view your Jupyter notebook with JavaScript content rendered or to share your notebook files with others you can use nbviewer. For an example, see Linking and Interactions.ipynb rendered on nbviewer.
from: https://help.github.com/en/articles/working-with-jupyter-notebook-files-on-github

Jupyter Github Code Review

When doing a code review on jupyter notebooks in github, it shows only the html code that generates the notebook. Are there any extensions that would enable github to show the rendered jupyter notebook, along with the ability to comment on cells for code review?
Under the hood Notebook files are JSON documents. All the markdown, code, outputs are present in this JSON document. Since git diff used by GitHub is meant for text files, it's hard to read Jupyter Notebook diffs on GitHub.
I built a GitHub app ReviewNB specifically to review Jupyter Notebooks on GitHub. It integrates directly with your repositories on GitHub and provides visual diff and commenting support (see screenshot below).
There's also nbdime if you just want to access rendered diff locally.

Can I display an Ipython notebook hosted on bitbucket?

I have a very simple notebook, hosted on github and on bitbucket.
The github URL
displays fine in the nbviewer, but the bitbucket URL
- which should indicate the same trivial notebook - does not work with the nbviewer.
Is it possible that nbviewer only takes github notebooks?
Later comment:
my repo was private - so that was at least one reason why it could not work!
Since this is/was the first result when googling for this, I just thought I'd update and let everyone know that this is now an add-on available in Bitbucket. You can find it under Settings -> Find Integrations. The source and issue tracker are available here - https://bitbucket.org/bitbucket/bitbucket-nbviewer
Based on this issue on Bitbucket's issue tracker, it does not seem to be supported yet.
As pointed out by #ThomasK in the comments, you can display a notebook from bitbucket if you copy the raw address.
Just click on the three dots next to your notebook and copy the address that you get when you click on Open raw.
Copy this address...
... and paste it in the text box in https://nbviewer.jupyter.org/ ...
... and it will render your notebook: