Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip ignores dependency_links in setup.py

I have dependency_links in my setup.py:

... dependency_links = ['http://github.com/robot-republic/python-s3/tarball/master.tar.gz#egg=python-s3'], ... 

But it doesn't work. However install_requires works fine. Maybe there are another method to set up git repo as required for setup.py?

like image 520
syabro Avatar asked Sep 20 '12 18:09

syabro


People also ask

Does pip install use setup py?

@joeforker, pip uses setup.py behind the scenes.

Is setup py outdated?

py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. I found a very detailed write-up explaining this issue: "Why you shouldn't invoke setup.py directly" (October 2021).

What is Install_requires in setup py?

install_requires is a section within the setup.py file in which you need to input a list of the minimum dependencies needed for a project to run correctly on the target operating system (such as ubuntu). When pip runs setup.py, it will install all of the dependencies listed in install_requires.


2 Answers

This answer should help. In a nutshell, you need to specify the version (or "dev") for the #egg=python-s3 so it looks like #egg=python-s3-1.0.0.

Updates based on @Cerin's comment:

  • Pip 1.5.x has a flag to enable dependency-links processing: --process-dependency-links. I haven't tested it because I agree with the point below.
  • This discussion seems to indicate that using dependency-links for pip is a bad practice. Although this feature was enlisted for deprecation, it's not anymore. There's a valid use case for private packages.
like image 157
Laur Ivan Avatar answered Sep 24 '22 04:09

Laur Ivan


since pip version 18.1 PEP 508 URL is supported. That means you don't need the deprecated dependency_links anymore. You write the dependency directly in the install_requires list instead. The example from @Chad looks like this:

setup(     name='yourpackage',     version='1.7.5',     packages=[],     url='',     license='',     author='',     author_email='',     description='',     install_requires=[         'somepackage==1.2.0',         'repo @ https://github.com/user/archive/master.zip#egg=repo-1.0.0',         'anotherpackage==4.2.1'     ], ) 

To install your package you can simply write:

pip install yourpackage 

(without --process-dependency-links)

like image 44
Easy_Israel Avatar answered Sep 25 '22 04:09

Easy_Israel