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 20.2 - ValueError exception on improperly formatted package #8654

Closed
cjp256 opened this issue Jul 29, 2020 · 1 comment · Fixed by #8656
Closed

pip 20.2 - ValueError exception on improperly formatted package #8654

cjp256 opened this issue Jul 29, 2020 · 1 comment · Fixed by #8656
Labels
kind: crash For situations where pip crashes

Comments

@cjp256
Copy link

cjp256 commented Jul 29, 2020

Environment

  • pip version: 20.2
  • Python version: 3.6
  • OS: Ubuntu 18.04

Description

pip install now fails to install improperly packaged python project. The project has installed a file to 'purelib', rather than under the 'purelib' directory. While the broken project needs to be fixed, pip is now throwing an exception without a hint.

This change in behavior is from #8562 (#8562 (comment)).

Expected behavior

Prior to 20.2, pip install worked fine. The purelib file was not required and was seemingly ignored.

How to Reproduce

Using Ubuntu 18.04:
pip install -v http://archive.ubuntu.com/ubuntu/pool/main/p/python-apt/python-apt_1.6.5ubuntu0.2.tar.xz

Output

ERROR: Exception:
Traceback (most recent call last):
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 421, in run
    pycompile=options.compile,
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
    pycompile=pycompile,
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 831, in install
    requested=self.user_supplied,
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/operations/install/wheel.py", line 830, in install_wheel
    requested=requested,
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/operations/install/wheel.py", line 658, in _install_wheel
    for file in files:
  File "/tmp/venv/lib/python3.6/site-packages/pip/_internal/operations/install/wheel.py", line 587, in make_data_scheme_file
    _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2)
ValueError: not enough values to unpack (expected 3, got 2)

In this case, normed_path is python_apt-0.0.0.data/purelib, and points to a file (not a directory).

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jul 29, 2020
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 29, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 29, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 29, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 29, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 29, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
@chrahunt
Copy link
Member

To add to the reproduction instructions:

cd "$(mktemp -d)"
python -m venv .env
./.env/bin/python -m pip install --upgrade pip
./.env/bin/python -m pip install wheel
sudo apt install libapt-pkg-dev
./.env/bin/python -m pip install -v http://archive.ubuntu.com/ubuntu/pool/main/p/python-apt/python-apt_1.6.5ubuntu0.2.tar.xz

which results in

ERROR: Exception:
Traceback (most recent call last):
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 412, in run
    installed = install_given_reqs(
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/req/__init__.py", line 82, in install_given_reqs
    requirement.install(
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 823, in install
    install_wheel(
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py", line 821, in install_wheel
    _install_wheel(
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py", line 657, in _install_wheel
    for file in files:
  File "/tmp/user/1000/tmp.wTL19RjBCa/.env/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py", line 586, in make_data_scheme_file
    _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2)
ValueError: not enough values to unpack (expected 3, got 2)

@chrahunt chrahunt added the kind: crash For situations where pip crashes label Jul 29, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 29, 2020
cjp256 pushed a commit to canonical/snapcraft that referenced this issue Jul 30, 2020
Currently python3-apt package is not installable with pip without
a patch.  Switch to the stage-package, which has the benefit
of matching the base (and up-to-date).

pypa/pip#8654

Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
bors bot referenced this issue in duckinator/emanate Aug 5, 2020
158: Update pip to 20.2.1 r=duckinator a=pyup-bot


This PR updates [pip](https://pypi.org/project/pip) from **20.2** to **20.2.1**.



<details>
  <summary>Changelog</summary>
  
  
   ### 20.2.1
   ```
   ===================

Features
--------

- Ignore require-virtualenv in ``pip list`` (`8603 &lt;https://github.com/pypa/pip/issues/8603&gt;`_)

Bug Fixes
---------

- Correctly find already-installed distributions with dot (``.``) in the name
  and uninstall them when needed. (`8645 &lt;https://github.com/pypa/pip/issues/8645&gt;`_)
- Trace a better error message on installation failure due to invalid ``.data``
  files in wheels. (`8654 &lt;https://github.com/pypa/pip/issues/8654&gt;`_)
- Fix SVN version detection for alternative SVN distributions. (`8665 &lt;https://github.com/pypa/pip/issues/8665&gt;`_)
- New resolver: Correctly include the base package when specified with extras
  in ``--no-deps`` mode. (`8677 &lt;https://github.com/pypa/pip/issues/8677&gt;`_)
- Use UTF-8 to handle ZIP archive entries on Python 2 according to PEP 427, so
  non-ASCII paths can be resolved as expected. (`8684 &lt;https://github.com/pypa/pip/issues/8684&gt;`_)

Improved Documentation
----------------------

- Add details on old resolver deprecation and removal to migration documentation. (`8371 &lt;https://github.com/pypa/pip/issues/8371&gt;`_)
- Fix feature flag name in docs. (`8660 &lt;https://github.com/pypa/pip/issues/8660&gt;`_)
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pip
  - Changelog: https://pyup.io/changelogs/pip/
  - Homepage: https://pip.pypa.io/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: crash For situations where pip crashes
Projects
None yet
2 participants