Import Jupyter Notebook from GitHub

Import Jupyter Notebook from GitHub

To import a Jupyter Notebook from GitHub (or any other place on the Internet), you need to:

  1. Download the file.
  2. Run it in Jupyter.

I created an example Jupyter Notebook that can be imported and pushed it to a git repository:

The file contains one function. The function prints “Hello, World!” when called. The second cell of the notebook calls the function, so after importing it, we should see “Hello, World!” printed in Jupyter.

In another file, I wrote the following code:

!curl -O
%run to_be_imported.ipynb

The first line downloads the file and stores it in the file indicated by the URL. The second line imports the file to Jupyter Notebook.

Do you want to show your product/service to 25000 data science enthusiasts every month? I am looking for companies which would like to become a partner of this blog.

Are you interested? Is your employer interested? Here are the details of the offer.


If you import a file while running Jupyter Notebook on your machine (not in a Kaggle kernel or some other dockerized environment), the imported code will be executed on your machine!

The imported notebook has access to your files (can delete, modify or upload them somewhere). It may also contain code which downloads an executable file and runs it on your machine. Be careful ;)

Remember to share on social media!
If you like this text, please share it on Facebook/Twitter/LinkedIn/Reddit or other social media.

If you watch programming live streams, check out my YouTube channel.
You can also follow me on Twitter: @mikulskibartosz

If you want to hire me, send me a message on LinkedIn or Twitter.

If this article was helpful, consider donating to WWF or any other charity of your choice.
Bartosz Mikulski
Bartosz Mikulski * data scientist / software engineer * conference speaker * organizer of School of A.I. meetups in Poznań * co-founder of Software Craftsmanship Poznan & Poznan Scala User Group