question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Git+SSH dependencies have subtle (yet critical) differences from git clone

See original GitHub issue

Reproduction steps:

  1. Have a git repository which is private, and is a pip package.
  2. Have a deploy key which can read the repository.
  3. Confirm you can run git clone git@github.com:account/private-pip-package.git
  4. Google around and discover that the instructions to use a git repo as a pip dependency boil down to very nearly “prefixing the repo with git+ssh:// and suffix it with #egg=private-pip-package.”
  5. End up with a pip dependency of git+ssh://git@github.com:account/private-pip-package.git#egg=private-pip
  6. Try installing the package, but get a fatal: Could not read from remote repository. instead.
  7. Run the gamut of tests (ssh git@github.com works, but ssh ssh://git@github.com fails …)
  8. Realize (after much hair-pulling) that instead of git+ssh://git@github.com:account/private-pip-package.git#egg=private-pip it should be git+ssh://git@github.com/account/private-pip-package.git#egg=private-pip (if you didn’t catch that, its github.com/account instead of github.com:account)

I would propose that a simple note in the failure message, or checking on input, or what have you, about the : vs. / would be quite helpful.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:29
  • Comments:32 (9 by maintainers)

github_iconTop GitHub Comments

23reactions
remohammadicommented, Jul 9, 2015

If you instead run setup(dependency_links=[‘git+ssh://git@github.com/account/private-pip-package.git#egg=private-pip’], install_reqs=[‘private-pip-package’], …), you’ll get an error like Could not find any downloads that satisfy the requirement private-pip-package (from package==1.2.3).

Pip wants to know the version before fetching (git clone) the dependency. If we specify the version after the project name in the egg string, in this hacky form: egg=<project name>-<version>, then there will be an item in _find_all_versions()'s returned list, and everything goes fine. So if we want to dependent our package on the latest commit in the branch STABLE-X of a VCS repository, we can do this:

install_requires=[
    'private-pip-packag',
],
dependency_links=[
    'git+ssh://git@github.com/account/private-pip-package.git@STABLE-X#egg=private-pip-9999999',
],

But, it’s too hacky! I think these days it’s so reasonable to have a project dependant on the latest version of a branch of some VCS repository, and there should be no need on specifying a dummy version number as a workaround for this purpose.

8reactions
ajmazuriecommented, Jun 24, 2016

Hi guys, I am having the very same problem of not being able to install a specific commit of a Github-hosted project using setuptoolsdependency_links option, and was wondering if this was still considered a bug or a misunderstanding of setuptools.

Say, for example, that I want to install a specific commit of the project paramiko-expect; for example, https://github.com/fgimian/paramiko-expect/tree/943630ac499284e6441854a9c4ae1e04301bfdd9

Here is what works and what doesn’t, using pip 8.1.2 and setuptools 23.1.0:

  • 🆗 pip install "git+ssh://git@github.com/fgimian/paramiko-expect.git@943630a#egg=paramiko-expect-0.2"
  • 🚫 (in dependency_links in setup.py) git+ssh://git@github.com/fgimian/paramiko-expect.git@943630a#egg=paramiko-expect-0.2
  • 🚫 (in dependency_links in setup.py) https://github.com/fgimian/paramiko-expect/archive/943630ac499284e6441854a9c4ae1e04301bfdd9.zip#egg=paramiko-expect-0.2
  • 🚫 (in dependency_links in setup.py) https://github.com/fgimian/paramiko-expect/zipball/943630a#egg=paramiko-expect-0.2

Note that the setup.py file then has paramiko-expect==0.2 in its install_requires field, and that I tried all possible variants of paramiko-expect versus paramiko_expect. The setup.py file is then used by typing pip install ..

Is there something I’m missing here? Best, Aurélien

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble installing private github repository using pip
... use github.com /account instead of github.com :account see Git+SSH dependencies have subtle (yet critical) differences from git clone.
Read more >
4.1 Git on the Server - The Protocols
Git over HTTPS can be a little more tricky to set up compared to SSH on some servers. Other than that, there is...
Read more >
Authenticating pipelines using git secret
A pipeline run or task run might require multiple authentications to access different Git repositories. Annotate each secret with the domains where Pipelines ......
Read more >
Use SSH keys to communicate with GitLab
The SSH key generated in WSL is not directly available for Git for Windows, and vice versa, as both have a different home...
Read more >
esx extra items
Contribute to BZN999/esx_extraitems development by creating an account on GitHub. Sharing templates and files results. With ESX Server, there are three ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found