Dealing with a `_`-using package name the dependency check exeption is delivering a false positive
See original GitHub issueDescription
It is possible to create pypi packages with an underscore.
Using such a package in a different versions than another package which shall also be installed alongside, a wrong version conflict exception is raised even thou the dependency could be solved.
Expected behavior
Either: The dependency should be solved as if the package name was written with dashes instead of underscores. Or: Another exception should be thrown that a check is not possible due to irregular package names.
pip version
22.0.2
Python version
- occurred in 3.8.14
- recreated in 3.10
OS
macOs 12.6
How to Reproduce
- If we have a package
c_c
with two versions.
# ~/packages/c_c_0.1.0
from setuptools import setup
setup(name="c_c", version="0.1.0")
# ~/packages/c_c_0.2.0
from setuptools import setup
setup(name="c_c", version="0.2.0")
- a package
a
depending onc_c==0.1.0
# ~/packages/a
from setuptools import setup
setup(name="a", version="0.1.0", install_requires=["c_c==0.1.0"])
- and we create a
requirements.txt
with an unpinnedc_c
# requirements.txt
c_c
~/packages/a
- and c_c is already installed in any version differing from the one needed by
a
pip install ./~/packages/c_c_0.2.0
- then the try to install requirements.txt leads to a wrong version conflict exception between
c_c
andc_c==0.1.0
.
The conflict shown is not a conflict since the user did not specify any version.
Furthermore if c_c
is not installed at all (and both versions are available for pip
) it installs just fine with c_c==0.1.0
.
Note: I am sorry that I am not skilled enough to create a self-sustaining example wit a local pypi server, but rest assured that this happens also just like that if both versions of c_c
are available (hence it is not an availability exception but a version conflict exception)-
Output
❯ cd ~/packages
❯ pip3 install ./c_c
Processing ./c_c
Preparing metadata (setup.py) ... done
Building wheels for collected packages: c-c
Building wheel for c-c (setup.py) ... done
Created wheel for c-c: filename=c_c-0.2.0-py3-none-any.whl size=889 sha256=739b63bb8d4a64bc7b1455a64a1b5f4309338c8e2035c01862c5a63ab08da77e
Stored in directory: /private/var/folders/fc/b2nq3p2978s75t6dxy406mj80000gn/T/pip-ephem-wheel-cache-3okv1c5q/wheels/e9/14/e2/66c0fd31081bed02d878e53f86d6f5e486458a930736225c2b
Successfully built c-c
Installing collected packages: c-c
Successfully installed c-c-0.2.0
❯ pip3 install -r b/requirements.txt
Processing ./a
Preparing metadata (setup.py) ... done
Requirement already satisfied: c_c in /usr/local/lib/python3.10/site-packages (from -r b/requirements.txt (line 1)) (0.2.0)
INFO: pip is looking at multiple versions of c-c to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r b/requirements.txt (line 2) and c_c because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested c_c
a 0.1.0 depends on c_c==0.1.0
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Without an example that we can reproduce to understand the issue you’re describing, there’s not much we can do. And we’re all volunteers here, so you should be aware that 6 days is not a particularly long time to wait in any case.
Feel free to post an example that we can reproduce here, and we’ll reopen the issue. Otherwise, we can’t understand the issue you’re trying to point out so there’s nothing we can do.
Well? 6 days have past. I am a bit frustrated, honestly.
I mean, at least something like, “if you manage to create a self-sustaining example, just open a new bugticket” would have been nice.
I will reach out to you again, once I have found the time.