Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip does not detect library name clashes #11240

Closed
1 task done
solney-syn opened this issue Jul 8, 2022 · 1 comment
Closed
1 task done

Pip does not detect library name clashes #11240

solney-syn opened this issue Jul 8, 2022 · 1 comment
Labels
resolution: duplicate Duplicate of an existing issue/PR

Comments

@solney-syn
Copy link

Description

It's possible to install two packages that both install to the same location, e.g both semver and node-semver install to semver (noted here)
Although pip cannot prevent this it would be helpful if could alert the user.

This would be beneficial as otherwise the problem can lurk undetected for some time and be more difficult to fix later, especially if clash is caused by transitive dependencies.

Expected behavior

If this occurs then pip should fail, informing the user of possible approaches to fix the problem e.g using separate venvs.

$ pip install semver node-semver
Error: Namespace clash. Both packages use the `semver` namespace

pip version

22.1.2

Python version

3.8.10

OS

Linux

How to Reproduce

  1. Create venv python3 -m venv env
  2. Get latest pip env/bin/pip install -U pip
  3. Install the two packages env/bin/pip install semver node-semver
  4. Try to import from semver env/bin/python -c 'from semver import VersionInfo'

Output

+ python3 -m venv env
+ env/bin/pip install -U pip
Collecting pip
  Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-22.1.2
+ env/bin/pip install semver node-semver
Collecting semver
  Using cached semver-2.13.0-py2.py3-none-any.whl (12 kB)
Collecting node-semver
  Using cached node_semver-0.8.1-py3-none-any.whl (24 kB)
Installing collected packages: node-semver, semver
Successfully installed node-semver-0.8.1 semver-2.13.0
+ env/bin/python -c 'from semver import VersionInfo'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'VersionInfo' from 'semver' (/home/solney/tmp/env/lib/python3.8/site-packages/semver/__init__.py)

Code of Conduct

@solney-syn solney-syn added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Jul 8, 2022
@pradyunsg
Copy link
Member

Duplicate of #4625

@pradyunsg pradyunsg marked this as a duplicate of #4625 Jul 8, 2022
@pradyunsg pradyunsg added resolution: duplicate Duplicate of an existing issue/PR and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Jul 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants