Is there a way to use an extra Python package index (ala pip --extra-index-url pypi.example.org mypackage
) with setup.py
so that running python setup.py install
can find the packages hosted on pypi.example.org
?
Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
The official Python Package Index Remote Storage URL value to enter is https://pypi.org/ . Using https://pypi.python.org/ should also work as long as redirects are maintained. The repository manager can access Python packages and tools from the remote index.
package_dir = {'': 'lib'} in your setup script. The keys to this dictionary are package names, and an empty package name stands for the root package. The values are directory names relative to your distribution root.
Config file locations are documented https://pip.pypa.io/en/stable/user_guide/#config-file. For me, it was located in /etc/pip.
If you're the package maintainer, and you want to host one or more dependencies for your package somewhere other than PyPi, you can use the dependency_links option of setuptools
in your distribution's setup.py
file. This allows you to provide an explicit location where your package can be located.
For example:
from setuptools import setup setup( name='somepackage', install_requires=[ 'somedep' ], dependency_links=[ 'https://pypi.example.org/pypi/somedep/' ] # ... )
If you host your own index server, you'll need to provide links to the pages containing the actual download links for each egg, not the page listing all of the packages (e.g. https://pypi.example.org/pypi/somedep/
, not https://pypi.example.org/
)
setuptools uses easy_install under the hood.
It relies on either setup.cfg or ~/.pydistutils.cfg as documented here.
Extra paths to packages can be defined in either of these files with the find_links. You can override the registry url with index_url but cannot supply an extra-index-url. Example below inspired by the docs:
[easy_install] find_links = http://mypackages.example.com/somedir/ http://turbogears.org/download/ http://peak.telecommunity.com/dist/ index-url = https://mypi.example.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With