Unexpected --target behavior with/without --upgrade
See original GitHub issueEnvironment
- pip version:
$ docker run -it python pip --version
pip 20.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
- Python version:
$ docker run -it python python --version
Python 3.8.5
- OS:
$ docker run -it python uname -a
Linux 098fbbd81e20 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 GNU/Linux
Description
In a fresh Docker container, Iβm seeing a difference in the files installed between pip install X --target /tmp and pip install X --target /tmp --upgrade. My understanding of --target is that the --upgrade flag will only produce different behavior if thereβs already an existing installation present.
I canβt determine if this due to a badly formed distribution of the project in question, a bug in pip, wheel, or a combination of them all.
(You can ignore --no-deps below, I just included it to keep the output smaller).
Behavior without --upgrade
$ docker run -it python bash
root@cdd4f75b6a82:/# ls /tmp
root@b899188462d1:/# pip install -t /tmp --no-deps teradatasql
Collecting teradatasql
  Downloading teradatasql-17.0.0.4-py3-none-any.whl (16.4 MB)
     |ββββββββββββββββββββββββββββββββ| 16.4 MB 5.2 MB/s
Installing collected packages: teradatasql
Successfully installed teradatasql-17.0.0.4
WARNING: Target directory /tmp/teradatasql already exists. Specify --upgrade to force replacement.
root@b899188462d1:/# tree /tmp
/tmp
βββ teradatasql
βΒ Β  βββ __init__.py
βΒ Β  βββ __pycache__
βΒ Β  βΒ Β  βββ __init__.cpython-38.pyc
βΒ Β  βΒ Β  βββ vernumber.cpython-38.pyc
βΒ Β  βββ teradatasql.dll
βΒ Β  βββ teradatasql.dylib
βΒ Β  βββ teradatasql.so
βΒ Β  βββ vernumber.py
βββ teradatasql-17.0.0.4.dist-info
    βββ INSTALLER
    βββ METADATA
    βββ RECORD
    βββ REQUESTED
    βββ WHEEL
    βββ top_level.txt
3 directories, 13 files
Behavior with --upgrade
$ docker run -it python bash
root@cdd4f75b6a82:/# ls /tmp
root@6c6a7d9f84a7:/# pip install -t /tmp --no-deps --upgrade teradatasql
Collecting teradatasql
  Downloading teradatasql-17.0.0.4-py3-none-any.whl (16.4 MB)
     |ββββββββββββββββββββββββββββββββ| 16.4 MB 7.3 kB/s
Installing collected packages: teradatasql
Successfully installed teradatasql-17.0.0.4
root@6c6a7d9f84a7:/# tree /tmp
/tmp
βββ teradatasql
βΒ Β  βββ LICENSE
βΒ Β  βββ README.md
βΒ Β  βββ THIRDPARTYLICENSE
βΒ Β  βββ samples
βΒ Β      βββ BatchInsPerf.py
βΒ Β      βββ BatchInsert.py
βΒ Β      βββ CharPadding.py
βΒ Β      βββ CommitRollback.py
βΒ Β      βββ DriverDatabaseVersion.py
βΒ Β      βββ ElicitFile.py
βΒ Β      βββ FakeResultSetCon.py
βΒ Β      βββ FakeResultSetEsc.py
βΒ Β      βββ FastLoadBatch.py
βΒ Β      βββ HelpSession.py
βΒ Β      βββ IgnoreErrors.py
βΒ Β      βββ InsertXML.py
βΒ Β      βββ LoadCSVFile.py
βΒ Β      βββ MetadataFromPrepare.py
βΒ Β      βββ ParamDataTypes.py
βΒ Β      βββ StoredProc.py
βΒ Β      βββ TJEncryptPassword.py
βΒ Β      βββ __pycache__
βΒ Β      βΒ Β  βββ BatchInsPerf.cpython-38.pyc
βΒ Β      βΒ Β  βββ BatchInsert.cpython-38.pyc
βΒ Β      βΒ Β  βββ CharPadding.cpython-38.pyc
βΒ Β      βΒ Β  βββ CommitRollback.cpython-38.pyc
βΒ Β      βΒ Β  βββ DriverDatabaseVersion.cpython-38.pyc
βΒ Β      βΒ Β  βββ ElicitFile.cpython-38.pyc
βΒ Β      βΒ Β  βββ FakeResultSetCon.cpython-38.pyc
βΒ Β      βΒ Β  βββ FakeResultSetEsc.cpython-38.pyc
βΒ Β      βΒ Β  βββ FastLoadBatch.cpython-38.pyc
βΒ Β      βΒ Β  βββ HelpSession.cpython-38.pyc
βΒ Β      βΒ Β  βββ IgnoreErrors.cpython-38.pyc
βΒ Β      βΒ Β  βββ InsertXML.cpython-38.pyc
βΒ Β      βΒ Β  βββ LoadCSVFile.cpython-38.pyc
βΒ Β      βΒ Β  βββ MetadataFromPrepare.cpython-38.pyc
βΒ Β      βΒ Β  βββ ParamDataTypes.cpython-38.pyc
βΒ Β      βΒ Β  βββ StoredProc.cpython-38.pyc
βΒ Β      βΒ Β  βββ TJEncryptPassword.cpython-38.pyc
βΒ Β      βββ airports.csv
βΒ Β      βββ udfinc.c
βββ teradatasql-17.0.0.4.dist-info
    βββ INSTALLER
    βββ METADATA
    βββ RECORD
    βββ REQUESTED
    βββ WHEEL
    βββ top_level.txt
4 directories, 45 files
Expected behavior
The same files are installed regardless of whether --upgrade is specified.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (14 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
Target Behavior Documentation
Target Behavior Documentation Date. You can tally this information, Yes or No this information, and change the target behaviors ...
Read more >Complete Guide to Managing Behavior Problems
Target behaviors should be: Specific (so expectations are clear to everyone in the family); Observable; Measurable (so everyone can agreeΒ ...
Read more >Response: Several Ways To Respond To βUnpredictable ...
The only practical way to minimize unpredictable negative behaviors is to be proactive, rather than resorting to the usual reactive approach ofΒ ...
Read more >39 Behavior Goals for an IEP including Work/Task ...
Can you have a Behavior Plan without an IEP? ... to avoid engaging in unexpected behavior, with one reminder, on 4 out of...
Read more >Tier I Interventions for Disruption in Class
Behavioral contract : The student and teacher hammer out a written agreement that outlines: specific positive behaviors that the student is to engage...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Probably in pip, since pip implements wheel installation internally. I think instead of letting the directories overwrite each other, pip should merge them and emit warnings when there are duplicate files.
/cc @dholth
Also adding awaiting PR since weβve more or less concluded how this should be resolved, and βonlyβ need someone to have the time to actually implement it.