0

I have been given a link to a github repository and informed to install using pip install rep-name unfortunately I was advised not to share the exact URL for now, so I will use rep-name. This question may be related to Install a downloaded package from GitHub but I am not using npm.

In Jupyter notebook I used the following:

pip install git+https://github.com/xyz/rep-name.git

But got errors like: Host key verification failed. fatal: Could not read from remote repository.

Now I have downloaded the repository as zip folder and placed it in C:\MyFolder. How can I run pip install on that zipped folder?

torek
  • 448,244
  • 59
  • 642
  • 775
Karl 17302
  • 57
  • 6
  • 1
    (Note: this has nothing to do with your question as asked. It is instead background *about* your question. Your question has nothing to do with Git itself, since you've already successfully downloaded a commit's snapshot. Note that you have not downloaded a *repository*, only *one commit from* a repository, or rather, its files. You're not dealing with Git at all here.) "Host key verification failed" means you're using ssh, not https. See [Git error: "Host Key Verification Failed" when connecting to remote repository](https://stackoverflow.com/q/13363553/1256452). – torek Jun 06 '22 at 19:03
  • Thanks, how can I switch to http then? Since the in the post, ssh is explicitly used but I am using https in the command – Karl 17302 Jun 07 '22 at 03:56
  • 1
    Not really sure - I thought pip would obey the `git+https` here and use https, yet yours clearly isn't. Do you have a Git configuration item that says to use ssh instead of https? (Use `git config --list --show-origin | grep -i insteadof`, on a Unix-like shell, to find out.) If that's not it, perhaps there's something peculiar in Jupyter here. – torek Jun 07 '22 at 15:20

2 Answers2

2

The easiest way to do this is most likely by first downloading using git and then installing with pip e.g.

Optionally, you can clone the repro again to assure non of your previous changes interfere with the installation.

git clone https://github.com/xyz/rep-name.git repro_name

If all is good you can just cd into your repro and install:

cd repro_name
pip install -e .

Note that any changes that will be made to the repro will be automatically updated in the your environment due to the editable (-e) tag.

Jop Knoppers
  • 676
  • 1
  • 10
  • 22
  • Why clone when the OP has already downloaded the repo as zip? – phd Jun 06 '22 at 20:41
  • 1
    That is correct, I however like to make sure everything is well before taking the next steps. I also edited my answer to also account for your Note. – Jop Knoppers Jun 08 '22 at 07:52
0

Direct answer to your question:

First, unzip the downloaded file with :

!unzip repo_name.zip -d path/to/folder

Then, navigate to the repo and run the installation script.

cd path/to/folder/repo_name
pip install -e .
malcolmSH
  • 3
  • 3