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 install foo-bar failed even foo.bar package existed #5877

Closed
cuonglm opened this issue Oct 12, 2018 · 5 comments
Closed

pip install foo-bar failed even foo.bar package existed #5877

cuonglm opened this issue Oct 12, 2018 · 5 comments
Labels
auto-locked Outdated issues that have been locked by automation C: finder PackageFinder and index related code resolution: duplicate Duplicate of an existing issue/PR

Comments

@cuonglm
Copy link

cuonglm commented Oct 12, 2018

Environment

  • pip version:
$ pip -V
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
  • Python version:
$ python -V
Python 2.7.12
  • OS:
$ uname -a
Linux minmon 4.15.0-34-generic #37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description

If there's a package named foo.bar in pypi, doing:

pip search foo-bar

returns foo.bar. But installing failed:

pip install foo-bar

Expected behavior
pip install foo-bar or pip install foo.bar successfully install package foo.bar

How to Reproduce

  1. Upgrade pip to latest version: pip install -U pip
  2. Install package: pip install -v dogpile-cache
  3. An error occurs.

Output

$ pip install -v dogpile-cache
Created temporary directory: /tmp/pip-ephem-wheel-cache-YDCbuO
The directory '/home/cuonglm/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Created temporary directory: /tmp/pip-req-tracker-wd6ueo
Created requirements tracker '/tmp/pip-req-tracker-wd6ueo'
Created temporary directory: /tmp/pip-install-NF4nHe
Collecting dogpile-cache
  1 location(s) to search for versions of dogpile-cache:
  * https://pypi.org/simple/dogpile-cache/
  Getting page https://pypi.org/simple/dogpile-cache/
  Looking up "https://pypi.org/simple/dogpile-cache/" in the cache
  Request header has "max_age" as 0, cache bypassed
  Starting new HTTPS connection (1): pypi.org:443
  https://pypi.org:443 "GET /simple/dogpile-cache/ HTTP/1.1" 200 2600
  Updating cache with response from "https://pypi.org/simple/dogpile-cache/"
  Caching due to etag
  Analyzing links from page https://pypi.org/simple/dogpile-cache/
    Skipping link https://files.pythonhosted.org/packages/44/ed/f0ea13fbf9626121c58aa1333b74aee612f3d784abab5da5b4e2ca0bc539/dogpile.cache-0.2.0.tar.gz#sha256=670c24d96cd9e75e1b90bf00493ef1ad3d1c699552a9cbe1ce5182c7c021edf4 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/d0/9e/ce6448bd30fb20a5be98cc8be521c565d30af14bf4eaff828789264617f6/dogpile.cache-0.2.1.tar.gz#sha256=a82fc1c18c36d74c9dbc00a86905890ff37bc4bc65ef0794182060d904a9e60c (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/47/c7/9eba204c269f0e4a2607d013faba3730c0ac74d0d62ed2d07db201d7ed29/dogpile.cache-0.2.2.tar.gz#sha256=a237df3522f3d079032145fcedc9d94b97610a4ad0ecb6d2f1f4cde517fd06b0 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/f0/10/f952d55f07803427786df1835d1ebe9f90a615a09b7f89ad3582038d59a2/dogpile.cache-0.2.3.tar.gz#sha256=6371b6f19c0286a3f1048ccbd37240fea0046558673a3f5b61601e4215563839 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/91/ff/fa0809c57bcdca12f7086772b2189909063f792397eb8a924ed6de3a09e9/dogpile.cache-0.2.4.tar.gz#sha256=fedbe44ee754635510392c82151066ba6dd5dfb715430aea3fe08e2b0fcae488 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/30/20/586472a1333495c0cb4f73a89ed3dbd0d1575e758b1eedba462818327fde/dogpile.cache-0.3.0.tar.gz#sha256=51010544fd679f61e20438c66f8117f924e78f631320e8903c9ba4241c8f9683 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/89/5b/97d650cc9820ea799cce9b974611898e0d83ccc6924434c60e4553f2269b/dogpile.cache-0.3.1.tar.gz#sha256=4cdc3959d08755af629995f45b25c6c507d71704b28cd0eafd1f3105c73e906f (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/a9/e9/1327ae3975bc353bd1eae89420dd4f6841308abf0a3d169c864b75455ace/dogpile.cache-0.4.0.tar.gz#sha256=06fa35aa892507f5ba4a0cda1279772d70dcfa8fb81fd8fccdcc858eae93d282 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/4d/82/b117284ebb9d12ee4bed7130662ae27ce8ffae05c8a0b68a52c0c411f366/dogpile.cache-0.4.1.tar.gz#sha256=d2a1f0459755cf71d91f4397b02dbb8ec101b5ccd1f036cf6322e595eabb462a (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/9c/f4/b43fa52203059e11e0b900df3aa82536b0f7f7958616fe321e3b800947ff/dogpile.cache-0.4.2.tar.gz#sha256=beec3b5486e0f1062fd692520c373c45bc41292c785650395c05d3aad5ec5276 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/ff/1e/292a8cef43518c6c3056e70bda6563e199c4f57594418d2a7edb243ed034/dogpile.cache-0.4.3.tar.gz#sha256=b3425e159a548634f3a1ccb9a934971ab4180ba1954479475c5aa81bfaa7186b (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/0b/aa/ee0a873384bee4c8f3ef7ab6d169e5c6e73d3a36a388c712066cec0dc56e/dogpile.cache-0.5.0.tar.gz#sha256=d02d15ad150783a284d0e0ebc69dcbac9b3c64784f4a4b2dada206173cf55c98 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/9a/c4/61feabeeae0ef2831c756fcfd09634caad9764e293f57895acebd3d3c40b/dogpile.cache-0.5.1.tar.gz#sha256=1f3165222bc23418cb9d3f1a2c9d554a091f412e5bc871ea0c48a19b576d06c0 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/10/32/df085e387dcb76ac115698e4016b9a866cb48fc82ecc80d33af8ef2e12e9/dogpile.cache-0.5.2.tar.gz#sha256=acdcb69e7eb8421678172fe8709d6d92bf7249022a70e4d7c84316d4e2d1d1b5 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/a4/d8/5d193515f11dd8c98f0295227f59a386a6d0e57ee687c979708259479392/dogpile.cache-0.5.3.tar.gz#sha256=2fe8c1a329830a9ada865a69cc5ebb2c2e6f2dbda3a6d4dbf5155c7d5194344b (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/5f/1e/2cca4354f23e3fe0d900abb846a238ade652d5467011dff157b4d557b713/dogpile.cache-0.5.4.tar.gz#sha256=9eab7a5dc05ad1b6573144c4a2717226b5c38811f9ec29b514e774535a91ea24 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/cd/7b/5d55589ee0accfa700abf5ad04823e66253931902e5bb07aa5c22e7dc7aa/dogpile.cache-0.5.5.tar.gz#sha256=30387ca6c146a627c69b700c56c16a3059b43727f11b28d9f918941f072860d6 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/c0/7d/55967422ed24acb39e9d9b6d6288f22907136e68d728594cf8e2c16d7215/dogpile.cache-0.5.6.tar.gz#sha256=f80544c5555f66cf7b5fc99f15431f3b35f78009bc6b03b58fe1724236bbc57b (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/07/74/2a83bedf758156d9c95d112691bbad870d3b77ccbcfb781b4ef836ea7d96/dogpile.cache-0.5.7.tar.gz#sha256=dcf99b09ddf3d8216b1b4378100eb0235619612fb0e6300ba5d74f10962d0956 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/16/15/8de884814301e26d273d51f0b07ad605f71cb7fad37deec096da4d2f031d/dogpile.cache-0.6.0.tar.gz#sha256=1b65aba2dde75cb577f275b5f3f4fcc635d21b3dc6781b98cef57bd009d93185 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/f6/a0/6f2142c58c6588d17c734265b103ae1cd0741e1681dd9483a63f22033375/dogpile.cache-0.6.1.tar.gz#sha256=69b52dc56bb52d974e9e9fb2764e1311abcd1fd625de07b4e5c05550ac9b40c0 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/9d/a9/ba70aadc6170841a1c6145e9039d4b1c2a4ef8c44cd0ca9b09ab79be9120/dogpile.cache-0.6.2.tar.gz#sha256=73793471af07af6dc5b3ee015abfaca4220caaa34c615537f5ab007ed150726d (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/94/bf/1b07b1a18733d22aad9660ed43f23a48c55a3573ae3e9dbc8dec9cd352ba/dogpile.cache-0.6.3.tar.gz#sha256=e9747f5e31f8dea1b80d6204358885f943f69e53574d88005438ca3651c44553 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/b6/3d/35c05ca01c070bb70d9d422f2c4858ecb021b05b21af438fec5ccd7b945c/dogpile.cache-0.6.4.tar.gz#sha256=a73aa3049cd88d7ec57a1c2e8946abdf4f14188d429c1023943fcc55c4568da1 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/65/24/7bd97e9d486c37ac03ef6ae3a590db1a8e02183e5d7ce9071bcca9d86c44/dogpile.cache-0.6.5.tar.gz#sha256=631197e78b4471bb0e93d0a86264c45736bc9ae43b4205d581dcc34fbe9b5f31 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/48/ca/604154d835c3668efb8a31bd979b0ea4bf39c2934a40ffecc0662296cb51/dogpile.cache-0.6.6.tar.gz#sha256=044d4ea0a0abc72491044f3d3df8e1fc9e8fa7a436c6e9a0da5850d23a0d16c1 (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
    Skipping link https://files.pythonhosted.org/packages/ee/bd/440da735a11c6087eed7cc8747fc4b995cbac2464168682f8ee1c8e43844/dogpile.cache-0.6.7.tar.gz#sha256=fca7deb7c276b879b01c15c5d39b3c05701dc43b263ec3fef1e52cb851cf88ab (from https://pypi.org/simple/dogpile-cache/); Missing project version for dogpile-cache
  Could not find a version that satisfies the requirement dogpile-cache (from versions: )
Cleaning up...
Removed build tracker '/tmp/pip-req-tracker-wd6ueo'
No matching distribution found for dogpile-cache
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/install.py", line 318, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 102, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 256, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/operations/prepare.py", line 218, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_install.py", line 164, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 621, in find_requirement
    'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for dogpile-cache
@cuonglm
Copy link
Author

cuonglm commented Oct 12, 2018

The problem is here.

In case of dogpile.cache, the egg info is dogpile.cache-0.6.7 while search name supplied is dogpile-cache, that's why egg_info_matches return None.

I'm not sure it's egg_info_matches problem or the tool which pass wrong search name.

@cuonglm
Copy link
Author

cuonglm commented Oct 12, 2018

In PEP 503:

This PEP references the concept of a "normalized" project name. As per PEP 426 the only valid characters in a name are the ASCII alphabet, ASCII numbers, ., -, and _. The name should be lowercased with all runs of the characters ., -, or _ replaced with a single - character. This can be implemented in Python with the re module:

import re

def normalize(name):
    return re.sub(r"[-_.]+", "-", name).lower()

IMHO, it's egg_info_matches problem, which does not treat dogpile.cache and dogpile-cache as the same.

@cjerdonek
Copy link
Member

I believe this is a duplicate of issue #5870. Feel free to reopen if not.

@cjerdonek cjerdonek added resolution: duplicate Duplicate of an existing issue/PR C: finder PackageFinder and index related code labels Oct 12, 2018
@cuonglm
Copy link
Author

cuonglm commented Oct 12, 2018

@cjerdonek yes, it's duplicated

@lock
Copy link

lock bot commented May 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: finder PackageFinder and index related code resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants