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

Installing packages with different egg names fail in pip>=20.3 #9217

Closed
mabouels opened this issue Dec 3, 2020 · 4 comments
Closed

Installing packages with different egg names fail in pip>=20.3 #9217

mabouels opened this issue Dec 3, 2020 · 4 comments

Comments

@mabouels
Copy link

mabouels commented Dec 3, 2020

Environment

  • pip version: 20.3.1
  • Python version: 3.7.9
  • OS: Linux

Description

Since pip version 20.3, installing an editable package with a different #egg={name_different_than_pkg}, no longer works.

Expected behavior

This works fine for pip versions < 20.3.

How to Reproduce

For example:

pip install -e git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev

Output

Obtaining firexkit_dev from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev
  Updating ./venv/src/firexkit-dev clone
  WARNING: Generating metadata for package firexkit-dev produced metadata for project name firexkit. Fix your #egg=firexkit-dev fragments.
ERROR: Requested firexkit from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev has different name in metadata: 'firexkit'

Verbose Output

Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-8buh9558
Created temporary directory: /tmp/pip-req-tracker-eh_z8pj5
Initialized build tracking at /tmp/pip-req-tracker-eh_z8pj5
Created build tracker: /tmp/pip-req-tracker-eh_z8pj5
Entered build tracker: /tmp/pip-req-tracker-eh_z8pj5
Created temporary directory: /tmp/pip-install-0xkvew37
Obtaining firexkit_dev from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev
  Checking in /home/firex/venv/src/firexkit-dev for .git (git)...
  remote.origin.url https://github.com/FireXStuff/firexkit.git
  Clone in ./venv/src/firexkit-dev exists, and has correct URL (https://github.com/FireXStuff/firexkit.git)
  Updating ./venv/src/firexkit-dev clone
  git version 2.26.2
  8f0ff2515681cc76897a392167e5b2322c01aa8d refs/remotes/origin/HEAD
  Added firexkit_dev from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev to build tracker '/tmp/pip-req-tracker-eh_z8pj5'
    Running setup.py (path:/home/firex/venv/src/firexkit-dev/setup.py) egg_info for package firexkit-dev
    Created temporary directory: /tmp/pip-pip-egg-info-5_36xnp5
    Running command python setup.py egg_info
    running egg_info
    creating /tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info
    writing /tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/dependency_links.txt
    writing requirements to /tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/requires.txt
    writing top-level names to /tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/SOURCES.txt'
    reading manifest file '/tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching 'BUILD'
    writing manifest file '/tmp/pip-pip-egg-info-5_36xnp5/firexkit.egg-info/SOURCES.txt'
  WARNING: Generating metadata for package firexkit-dev produced metadata for project name firexkit. Fix your #egg=firexkit-dev fragments.
  Source in ./venv/src/firexkit-dev has version 4.0, which satisfies requirement firexkit from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev
  Removed firexkit from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev from build tracker '/tmp/pip-req-tracker-eh_z8pj5'
ERROR: Requested firexkit from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev has different name in metadata: 'firexkit'
Exception information:
Traceback (most recent call last):
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'firexkit-dev'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 210, in _main
    status = self.run(options, args)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 319, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 310, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 79, in from_requirement
    cands = build_iter_view(provider.find_matches([requirement]))
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_vendor/resolvelib/structs.py", line 148, in build_iter_view
    matches = list(matches)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 240, in <genexpr>
    if constraint.is_satisfied_by(c)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/base.py", line 66, in is_satisfied_by
    return self.specifier.contains(candidate.version, prereleases=True)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 189, in version
    self._version = self.dist.parsed_version
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 234, in dist
    self._prepare()
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 227, in _prepare
    self._check_metadata_consistency(dist)
  File "/home/firex/venv/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 211, in _check_metadata_consistency
    raise MetadataInconsistent(self._ireq, "name", dist.project_name)
pip._internal.exceptions.MetadataInconsistent: Requested firexkit from git+https://github.com/FireXStuff/firexkit.git#egg=firexkit_dev has different name in metadata: 'firexkit'
Removed build tracker: '/tmp/pip-req-tracker-eh_z8pj5
@mabouels mabouels changed the title Installing packages with different egg names fail in pip>20.3 Installing packages with different egg names fail in pip>=20.3 Dec 3, 2020
@brainwane brainwane added the state: needs eyes Needs a maintainer/triager to take a closer look label Dec 4, 2020
@brainwane
Copy link
Contributor

Hello and thank you for your bug report! I'm sorry you're having trouble right now. Thank you for sharing your report with us.

Here's a list of some things to watch out for in the new version of pip, including some changes to how we deal with editable packages.

I'll mention here one useful troubleshooting and workaround tip from the documentation: if you need a temporary workaround, you can choose the old resolver behavior using the flag --use-deprecated=legacy-resolver. This will work until we release pip 21.0 (see Deprecation timeline).

(If you don't mind, please also tell us what could have happened differently so you could have tested and caught and reported this during the pip resolver beta period.)

@brainwane
Copy link
Contributor

@uranusjr @pradyunsg An acquaintance of mine filed pypa/packaging-problems#428 and thought it might be related to this issue; is it?

@uranusjr
Copy link
Member

I believe the packaging-problems issue is a symptom of #9429. The new resolver requires URLs to match exactly, but the legacy #egg= suffix is problemantic. It’s inherently at part of an URL, but old pip code kind of not treat it that way.

@pradyunsg pradyunsg removed the state: needs eyes Needs a maintainer/triager to take a closer look label Oct 7, 2022
@pradyunsg
Copy link
Member

Closing this out since:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants