Re: [Distutils] install_requires option to force pypi url or a better approach?
At 06:12 PM 12/18/2009 +0100, Aljoa MohoroviÄ wrote:
i've setup private pypi where i can upload some packages that are not suitable for pypi.python.org. my package, let's call it myapp, contains "install_requires=['django',]" but with that requirement i can't install it. -------------------------------------------------- $ virtualenv --no-site-packages --distribute env New python executable in env/bin/python A globally installed setuptools was found (in /usr/lib/python2.6/dist-packages) Use the --no-site-packages option to use distribute in the virtualenv. Installing distribute...........................................................................................................................................................................done. $ . env/bin/activate $ pip freeze distribute==0.6.8 wsgiref==0.1.2 $ pip install myapp -i http://pypi.example.com Downloading/unpacking myapp  Using download cache from /home/aljosa/.pip-cache/<MYAPP PKG URL>  Running setup.py egg_info for package myapp Downloading/unpacking django (from myapp)  Could not find any downloads that satisfy the requirement django (from myapp) No distributions at all found for django (from myapp) -------------------------------------------------- since i can normally install django with "pip install django" i assume that when i set "-i http://pypi.example.com" it's also used for install_requires. any tips on using multiple pypi repositories? is there some way to define which pypi url to use for package installation?
You would probably be better off using the find_links option in your setup(), to indicate additional URLs where packages can be found. e.g. find_links=['http://pypi.example.com/somepackage', 'http://pypi.example.com/otherpackage']. This will tell easy_install (or other packaging tools) to check these pages in addition to the standard package-index pages, when seeking out your dependencies.
On Fri, Dec 18, 2009 at 11:58 PM, P.J. Eby <pje@telecommunity.com> wrote: [..]
You would probably be better off using the find_links option in your setup(), to indicate additional URLs where packages can be found. e.g. find_links=['http://pypi.example.com/somepackage', 'http://pypi.example.com/otherpackage']. This will tell easy_install (or other packaging tools) to check these pages in addition to the standard package-index pages, when seeking out your dependencies.
I think it's pretty tedious to add a find_links entry for each dependency, when they are all available on some PyPI servers. Since Pip allows to configure two PyPI servers at installation time, And if the distribution is released in some other repository some day (let's say PyPI) and these urls are internal, this list will have to be changed accordingly.
From my experience, adding some find-links in a distribution's setup.py is a bad practice in general: for instance, if you want to change the package index in the package installer to control where files are downloaded, find-links will by-pass this unless you use the "allow-hosts" option.
I had trouble with this problem for example in some places where people had a firewall : if *one* package had a find-links, the installer was trying to look it up, even if I had a full local PyPI mirror So I had to use the allow-host option to avoid this. And just because some dependency I didn't control had a find-link. If some dependencies are not available at PyPI. the way to get them and install them should be documented but not forced imho. And in Aljoša's case, they are in a PyPI-like server, so it's just a matter of configuring pip. Tarek
participants (2)
-
P.J. Eby -
Tarek Ziadé