question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected --target behavior with/without --upgrade

See original GitHub issue

Environment

  • 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:open
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Aug 25, 2020

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

0reactions
uranusjrcommented, Feb 6, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found