How to use a new repository downloaded from github

Hello,
I am a new user of python and github.
I want to use a new repository (module) published on github.
I downloaded the zip folder and extracted it. , but I don’t know how to use this module with jupyter (on windows 10).
How can I import this module into jupyter .
Thanks!

A lot depends on how ‘New’ it is. You don’t provide any specifics, and so it is hard to advise you?

For example, what is the name of the module or the repository?
It may be as easy as typing the following in a notebook cell where <module_name> is replaced by the module name.

%pip install <module_name>
import <module_name>

Some module names aren’t exactly what you use in the install or import call. The correct syntax of the name will usually be shown in the documentation either at the repo or on PyPi.

I tried some method but without success

Why it is not possible to copy and paste directly a folder from my download folder (F:/téléchargement/) to a jupyter notebook folder (…/source/repos/ for example ) ?

This file is uploading in my drive :

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

Thank you @fomightez for your help !

1 Like