My project depends on some public packages and some private ones. One of these private ones has the same name as another public package on PyPi (let's call it 'conflicting'). In my setup.py file I have
install_requires = ['public_a', 'public_b', 'conflicting' ],
dependency_links = ['https:blah/blah/blah/conflicting.git#egg=conflicting']
Even though I specify the egg in my dependency links, pip still installs the public package 'conflicting'. Is there a way to prioritize private packages when there is a name conflict?
Packages housed within the Gitlab PyPi Registry are case-sensitive when retrieved. Using the latest stable pip ( 20.2. 2 ), this makes packages with capital letters impossible to retrieve as pip will make the name lowercase.
Usage. Simply run the command pipconflictchecker. If any dependency conflicts are found an output dump of all conflicts will be shown, and an exit code of 1 will be returned.
Pip is one of the most famous and widely used package management system to install and manage software packages written in Python and found in Python Package Index (PyPI). Pip is a recursive acronym that can stand for either "Pip Installs Packages" or "Pip Installs Python".
Pip does not provide true dependency resolution, but this can be solved by using it in conjunction with a requirements. txt file. Requirements. txt files can be used to make pip resolve dependency conflicts between different packages.
I know it's a bit of a hack, but this is easy and it actually works:
Add 100 to your local package's version numbers. As long as pip can find your local package via the --extra-index
or --find-links options
, it will compare the version numbers and take the highest available version that meets the versioning constraints specified in the setup.py of the dependent package. If your package has the higher version, it will win.
You can set up your own PyPi server and use it as primary source and the global one as secondary. This will prioritize your packages over the public ones.
e.g. manually:
pip install --index-url=<your-pipy-server> --extra-index-url=https://pypi.python.org/simple <your package>
Of course, errors could occur if the version you are trying to install is missing on your server but available from the conflicting public package.
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