How to use a new repository downloaded from github

Please when posting, put the pertinent link in the post as a link. Text as an image isn’t readily useable. You want to make it easy for people to help you. See Tim’s excellent post Getting good answers to your questions.


What you reference isn’t a module. Those are Python scripts as discussed in the accompanying documentation, referenced from [the raytrace repo by James Bowman](GitHub - jamesbowman/raytrace: Python raytracer).

Run this code below in your notebook to run the final script discussed here:

%pip install numpy
%pip install pillow
!curl -O https://raw.githubusercontent.com/jamesbowman/raytrace/master/rt3.py
%run rt3.py

You’ll then see a file rt3.png in your Jupyter dashboard, accessible by clicking on the Jupyter logo in the upper left of the screenshot you posted.

You can take the last two lines and put them in a new cell. And then edit those two lines to run the other scripts in the repository.


If your system doesn’t have curl try the fllowing:

!wget https://raw.githubusercontent.com/jamesbowman/raytrace/master/rt3.py

If you prefer to use git and fetch all the scripts at once and run them, place this in a cell:

!git clone https://github.com/jamesbowman/raytrace.git
%cd raytrace
%run rt2.py
%run rt3.py
%run rt4.py

The magic %cd command adjusts the working directory of the notebook, see here. When the repository is cloned by git, the contents go into a directory with the name of repository. The initial working directory for a notebook will likely be the home directory othwerise.

2 Likes