Search code examples
githubgithub-for-windows

Unable to clone code from Github into Jupyter Notebook?


I've been trying to download several packages from github with commands such as '''pip install https://github.com/strath-sdr/RFSoC-Book/archive/v1.0.1.tar.gz''' and

'''git clone https://github.com/strath-sdr/rfsoc_sam'''

'''pip3 install git+https://github.com/strath-sdr/rfsoc_radio'''

But I keep getting errors:

enter image description here

enter image description here

I've tried downloading multiple different packages, but none of them seem to work.

I'm rather new to coding. I've also tried following a tutorial and using git config --global user.name "John Doe" & git config --global user.email [email protected], which didn't work either.

enter image description here


Solution

  • For the git cloning you are trying in your bottom screenshot

    Go here and click on the 'launch binder' badge. When the temporary remote session comes up, click on the 'Terminal' tile in the 'Launcher' panel on the right, under 'Other' (third row). In the terminal that comes up then type the following:

    git clone https://github.com/strath-sdr/rfsoc_sam.git
    

    (that part after git clone comes from going to github page for strath-sdr/rfsoc_sam and and clicking the green code button and copying the https code from there.)
    You'll see that git clone command work. Compare that behavior to anything you try on your own machine because git works there in the temporary, remote session served via MyBinder.

    For the pip install of 'strath-sdr/RFSoC-Book' direct from the GitHub repo

    In same terminal as the session I suggest you start above, run the following:

    pip install git+https://github.com/strath-sdr/RFSoC-Book@main
    

    That will use pip to install packages rfsoc-book-1.0.1 rfsoc_freqplan-0.3.2 strath_sdfec-1.0.1 direct from the GitHub repo. The syntax probably doesn't match some old posts because Github began enforcing limiting things to https.

    There is another variant for the pip install that will work that I found is from here and that is:

    pip install https://github.com/ <username>/<reponame>/archive/<branch_name>.zip
    

    For this example that would be:

    pip install https://github.com/strath-sdr/RFSoC-Book/archive/main.zip
    

    (I believe this comment even suggests use of the zip to be faster.)

    The easiest way is to test this is to start a new temporary session using the 'launch binder' route as above and then try that command in a terminal there. Having a new session makes sure you know for sure each variant command for installing strath-sdr/RFSoC-Book direct from the GitHub repo works.


    Getting back to your issue, I understand getting it to work in sessions from MyBinder doesn't help on your computer, but it gives you a place to test commands without concern whether the issue is either the syntax of the command and your system or possibly both. You take the machine out of the equation to make it easier to work things out.