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

Problems with wheels an pip>=10 #73

Open
rupa108 opened this issue Apr 16, 2018 · 1 comment
Open

Problems with wheels an pip>=10 #73

rupa108 opened this issue Apr 16, 2018 · 1 comment

Comments

@rupa108
Copy link

rupa108 commented Apr 16, 2018

We are having issues with packages that contain "-" in their names when using wheels and a current version of pip.

eg. for python-dateutil dir2py generates following structure:

$ /var/pypi/packages-develop/simple/python-dateutil > ls -l
total 4
-rw-r--r-- 1 pypi pypi 636 Apr 16 13:09 index.html
lrwxrwxrwx 1 pypi pypi  48 Apr 16 13:09 python-dateutil-2.7.2-py2.py3-none-any.whl -> ../../python_dateutil-2.7.2-py2.py3-none-any.whl

and a index.html

<a href='python-dateutil-2.7.2-py2.py3-none-any.whl'>python-dateutil-2.7.2-py2.py3-none-any.whl</a><br />

With this structure in place pip will fail to install python-dateutil:

pip -vvv install --force-reinstall  https://*****/packages-develop/simple/ --only-binary python-dateutil python-dateutil
Created temporary directory: /tmp/pip-ephem-wheel-cache-r7m7ebh7
Created temporary directory: /tmp/pip-install-cl8flexr
Looking in indexes: https://****/packages-develop/simple/
Collecting python-dateutil
  1 location(s) to search for versions of python-dateutil:
  * https://*****/packages-develop/simple/python-dateutil/
  Getting page https://***/packages-develop/simple/python-dateutil/
  Looking up "https://****/packages-develop/simple/python-dateutil/" in the cache
  Current age based on date: 3372
  Ignoring unknown cache-control directive: 
  Freshness lifetime from request max-age: 600
  Starting new HTTPS connection (1): *************
  https://*********:443 "GET /packages-develop/simple/python-dateutil/ HTTP/1.1" 200 636
  Ignoring unknown cache-control directive: 
  Updating cache with response from "https://*******/packages-develop/simple/python-dateutil/"
  Caching due to etag
  Analyzing links from page https://****/packages-develop/simple/python-dateutil/
    Skipping link https://********/packages-develop/simple/python-dateutil/python-dateutil-2.6.1-py2.py3-none-any.whl (from https://******/packages-develop/simple/python-dateutil/); wrong project name (not python-dateutil)
  Could not find a version that satisfies the requirement python-dateutil (from versions: )
Cleaning up...
No matching distribution found for python-dateutil
Exception information:
Traceback (most recent call last):
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/operations/prepare.py", line 243, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/req/req_install.py", line 307, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/var/lib/go-agent/pipelines/accclient/accclient/debian/accclient/usr/share/nnis/accclient/lib/python3.4/site-packages/pip/_internal/index.py", line 533, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for python-dateutil

It turns out that pip fails to handle the filename python-dateutil properly. However if adjust the structure manually to:

$  /var/pypi/packages-develop/simple/python-dateutil > ls -l
total 4
-rw-r--r-- 1 pypi pypi 636 Apr 16 14:04 index.html
lrwxrwxrwx 1 pypi pypi  48 Apr 16 13:09 python_dateutil-2.7.2-py2.py3-none-any.whl -> ../../python_dateutil-2.7.2-py2.py3-none-any.whl
$ /var/pypi/packages-develop/simple/python-dateutil > cat index.html 
<a href='python_dateutil-2.7.2-py2.py3-none-any.whl'>python_dateutil-2.7.2-py2.py3-none-any.whl</a><br />

eveything is fine. (note the changes "-" -> "_")

Can you please adjust dir2py to generate symlinks and not translate "_" to "-" in filenames?

Regards
Roman

@liuwei5018
Copy link

I had just fixed this issue locally.
try change you local code: /usr/lib/python2.7/site-packages/libpip2pi/commands.py
line 131: return (to_safe_name(split[0]), split[0], to_safe_rest(split[1]))
line 326: pkg_name, origin_name, pkg_rest = file_to_package(pkg_basename, pkgdir)
line 340: pkg_new_basename = "-".join([origin_name, pkg_rest])
then try dir2pi, it will work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants