pypa / pypa/setuptools

"pip install --target" produces silently broken installation with latest setuptools

Open
#1,071 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Triage
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

When installing zope.deprecation and zope.interface via pip install --target, a strange warning occurs and the installation is left in an incomplete state.

This bug could be caused by PIP or by Setuptools. However, since the only difference between my working and my non-working system is the setuptools version, while the pip versions are equal, I decided to file the bug for setuptools. I tested only Python 2.7, not Python 3.

This is the smallest installation command that reproduces the bug:

rm -rf testdir/
pip install --target testdir/ zope.deprecation==4.2.0 zope.interface==4.4.2

Everything works fine on a system with latest pip 9.1.0 and older setuptools 33.1.1:

Collecting zope.deprecation==4.2.0
  Using cached zope.deprecation-4.2.0-py2.py3-none-any.whl
Collecting zope.interface==4.4.2
  Using cached zope.interface-4.4.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting setuptools (from zope.deprecation==4.2.0)
  Using cached setuptools-36.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools, zope.deprecation, zope.interface
Successfully installed setuptools-36.0.1 zope.deprecation-4.2.0 zope.interface-4.4.2

However, on a system with latest pip 9.1.0 and latest setuptools 36.0.1, this ends with a strange warning:

Collecting zope.deprecation==4.2.0
  Using cached zope.deprecation-4.2.0-py2.py3-none-any.whl
Collecting zope.interface==4.4.2
  Using cached zope.interface-4.4.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting setuptools (from zope.deprecation==4.2.0)
  Using cached setuptools-36.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools, zope.deprecation, zope.interface
Successfully installed setuptools-36.0.1 zope.deprecation-4.2.0 zope.interface-4.4.2
Target directory /.../testdir/zope already exists. Specify --upgrade to force replacement.

Despite the warning, pip exits with a success code (exit code 0) and shows "Successfully installed" for zope.deprecation as well as zope.interface. But zope.interface is not fully installed. There is just the dist-info but not the Python package itself, i.e. the directory interfaces/ in testdir/zope/ is missing:

$ ls -1 testdir/
easy_install.py
easy_install.pyc
pkg_resources
setuptools
setuptools-36.0.1.dist-info
zope
zope.deprecation-4.2.0.dist-info
zope.deprecation-4.2.0-py2.7-nspkg.pth
zope.interface-4.4.2.dist-info
zope.interface-4.4.2-py2.7-nspkg.pth
$ ls -1 testdir/zope/
deprecation

Moreover, when following the advice of the warning and adding --upgrade, the issue is still not solved:

rm -rf testdir/
pip install --upgrade --target testdir/ zope.deprecation==4.2.0 zope.interface==4.4.2

Now, the warning vanished and pip indicates success:

Collecting zope.deprecation==4.2.0
  Using cached zope.deprecation-4.2.0-py2.py3-none-any.whl
Collecting zope.interface==4.4.2
  Using cached zope.interface-4.4.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting setuptools (from zope.deprecation==4.2.0)
  Using cached setuptools-36.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools, zope.deprecation, zope.interface
Successfully installed setuptools-36.0.1 zope.deprecation-4.2.0 zope.interface-4.4.2

However, the situation is just flipped: zope.interface is installed but zope.deprecation is not. In other words, zope.deprecation has been replaced with zope.interfaces:

$ ls -1 testdir/
easy_install.py
easy_install.pyc
pkg_resources
setuptools
setuptools-36.0.1.dist-info
zope
zope.deprecation-4.2.0.dist-info
zope.deprecation-4.2.0-py2.7-nspkg.pth
zope.interface-4.4.2.dist-info
zope.interface-4.4.2-py2.7-nspkg.pth
$ ls -1 testdir/zope/
interface

In total, I see the following issues here:

  1. pip install --target produces an incomplete, broken installation
    • Success is indicated despite the broken installation
    • There is just a warning, not an error message
    • The warning message is misleading, as pip install --upgrade --target doesn't solve the issue (even though the warning message is technically almost correct)
  2. pip install --upgrade --target produces an incomplete, broken installation
    • Success is indicated despite the broken installation
    • There is neither a warning nor an error message

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported pip install --target and pip install --upgrade --target commands with Python 2.7, setuptools 36.0.1, and the pinned zope packages. Inspect the resulting testdir/zope/ contents and installation output; done means both packages are complete and an incomplete installation is not reported as successful.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.