question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dealing with a `_`-using package name the dependency check exeption is delivering a false positive

See original GitHub issue

Description

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

  1. 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")
  1. a package a depending on c_c==0.1.0
# ~/packages/a
from setuptools import setup
setup(name="a", version="0.1.0", install_requires=["c_c==0.1.0"])
  1. and we create a requirements.txt with an unpinned c_c
# requirements.txt
c_c
~/packages/a
  1. and c_c is already installed in any version differing from the one needed by a
pip install ./~/packages/c_c_0.2.0
  1. then the try to install requirements.txt leads to a wrong version conflict exception between c_c and c_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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, Oct 17, 2022

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.

0reactions
Magnaticommented, Oct 17, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Composer packages with hyphen not resolved to correct CPE
When running the dependency check, lots of vulnerabilities are erroneously listed against the package. This is because the CPE assig...
Read more >
Incorrect usage of go.sum in go dependency scanning - GitLab
When using the scanner, we often get false-positives, because the scanner does not recognize updated dependencies in the go.mod file.
Read more >
owasp Dependency check suppression for a specific CVE ...
I have tried providing all the cpe corresponding to the CVE entries. Thereby not providing individual sha1. <suppress> <notes><!
Read more >
How to find third-party vulnerabilities in your Java code
Learn four ways to check your Java projects for vulnerable dependencies. ... of 3rd party dependencies; false positives and false negatives may exist...
Read more >
Dependency-Check Report - Apache Struts
Dependency -Check is an open source tool performing a best effort analysis of 3rd party dependencies; false positives and false negatives may exist...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found