1

I'm having serious trouble with using setup.py to pip install my package which also has dependency links. I have read this answer and this one thoroughly and none of the answers including the accepted ones help.

Here is the setup.py for the package trying to install. Basically, it reads the requirements.txt to fill install_requires and dependency_links, most of the rest of the code is boilerplate from cookie-cutter. requirements.txt has a private github repo in it which is causing the issues. e.g. git+https://${GITHUB_OAUTH_TOKEN}@github.com/jmerkow/pripy.git#egg=pripy

When I run pip install -r requirements.txt everything works great, it installs the private repository. However, if I try to install using pip install . --process-dependency-links, I get this error:

Could not find a version that satisfies the requirement pripy (from mypackage==<sha>) (from versions: )
No matching distribution found for pripy (from mypackage==<sha>)

If I take off the #egg=xxx from the link in requirements, the private repo package is completely ignored by pip install . but not by pip install -r requirements.txt.

I have confirmed that dependency_links contains 'git+https://<actual-token>@github.com/jmerkow/pripy.git#egg=pripy' and that install_requires includes 'pripy'

How do you get setup to properly Is this a problem with the sub-package? setup.py in that repo is done pretty much the same, except there are no private links.

jmerkow
  • 1,483
  • 2
  • 17
  • 27

1 Answers1

2

Ugh, this always happens. I put in all the work to the question, then I figure it out myself.

The issue is two things, first, all dependeny_links need to have a version, second to pull the version from the requirements file properly you need to do some magic on the string.

Comparing to the above setup.py, I changes the way requirements are added to the two lists (updated here). Then add the version to #egg=xxx on the link e.g. git+https://${GITHUB_OAUTH_TOKEN}@github.com/jmerkow/pripy.git#egg=pripy-0.

Now setup.py will parse that file, take the egg version info, convert it to a pip version (basically replace the first '-' with an '==') for the install_requires, and you're good to go.

jmerkow
  • 1,483
  • 2
  • 17
  • 27