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.

"pip uninstall" stuck for long if no "-v" is given for some package

See original GitHub issue

Description

When uninstalling smashpy, pip stuck for long in listing the file to delete (and keep). WIth -v this stuck does not happen.

IMO, the function compress_for_output_listing has some problem with this package:

https://github.com/pypa/pip/blob/bef589d8cbaa74264c2cbffc839dda0917e2c7cb/src/pip/_internal/req/req_uninstall.py#L427-L428

Expected behavior

pip uninstall is generally expected to respond more quickly without -v than with it.

pip version

21.1.3

Python version

3.9.6

OS

Arch Linux

How to Reproduce

  1. pip install smashpy
  2. pip uninstall smashpy
    • pip displays the uninstall information slowly
  3. pip uninstall smashpy -v
    • pip displays the uninstall information quickly

Output

$ pip uninstall smashpy
Found existing installation: smashpy 0.0.8
Uninstalling smashpy-0.0.8:
  Would remove:
    /tmp/venv/lib/python3.9/site-packages/*
  Would not remove (might be manually added):
    /tmp/venv/lib/python3.9/site-packages/Keras-2.4.3.dist-info/INSTALLER
    /tmp/venv/lib/python3.9/site-packages/Keras-2.4.3.dist-info/LICENSE
    /tmp/venv/lib/python3.9/site-packages/Keras-2.4.3.dist-info/METADATA
    /tmp/venv/lib/python3.9/site-packages/Keras-2.4.3.dist-info/RECORD
    (thousands of lines omitted)

$ pip uninstall smashpy -v
Found existing installation: smashpy 0.0.8
Uninstalling smashpy-0.0.8:
  Would remove:
    /tmp/venv/lib/python3.9/site-packages/__init__.py
    /tmp/venv/lib/python3.9/site-packages/__pycache__/__init__.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/_version.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/pySMaSH.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/smashpy.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/_version.py
    /tmp/venv/lib/python3.9/site-packages/pySMaSH.py
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/INSTALLER
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/LICENSE
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/METADATA
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/RECORD
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/REQUESTED
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/WHEEL
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/top_level.txt
    /tmp/venv/lib/python3.9/site-packages/smashpy.py
  Will actually move:
    /tmp/venv/lib/python3.9/site-packages/__init__.py
    /tmp/venv/lib/python3.9/site-packages/__pycache__/__init__.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/_version.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/pySMaSH.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/__pycache__/smashpy.cpython-39.pyc
    /tmp/venv/lib/python3.9/site-packages/_version.py
    /tmp/venv/lib/python3.9/site-packages/pySMaSH.py
    /tmp/venv/lib/python3.9/site-packages/smashpy-0.0.8.dist-info/
    /tmp/venv/lib/python3.9/site-packages/smashpy.py

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, Jul 20, 2021

This looks like a bug in the packaging of smashpy - it’s installing files (including an __init__.py entry) direct into site-packages, and that’s somehow making pip think it needs to remove all of the site-packages directory!

Pip should probably protect better against badly packaged projects like this, but smashpy needs fixing as well…

0reactions
outloudvicommented, Jul 21, 2021

Got it. Thanks for your detailed explanation! ❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix pip hanging on uninstalling sqlalchjemy
Looks like pip uninstall prompts you with "Do you want to continue (Y/N)?", but that is not visible in cygwin or git bash...
Read more >
pip install --upgrade stalls at the "uninstalling" phase #6169
Running pip install --upgrade for any package that needs upgrading will cause pip to stall at the "Uninstalling" stage. Expected behavior.
Read more >
How to Uninstall Python Packages - ActiveState
Open a command window by entering 'cmd' in the Search Box of the Task bar; Press Ctrl+Shift+Enter to gain Administration (Admin) privileges; pip...
Read more >
pip Documentation
Successfully uninstalled SomePackage. Running setup.py install for SomePackage. Successfully installed SomePackage. Uninstall a package:.
Read more >
Uninstalling Anaconda Distribution
Full Uninstall¶ · In Windows, open Anaconda Prompt. In Mac or Linux, open your terminal application. · Install the anaconda-clean package: conda install...
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