pip icon indicating copy to clipboard operation
pip copied to clipboard

incorrect exit status when package cannot be uninstalled

Open benoit-pierre opened this issue 7 years ago • 12 comments

  • Pip version: 9.0.1 / 9.0.1-744-gcb696fce
  • Python version: 3.6.4
  • Operating system: Arch Linux

Description:

Add a package' source directory to PYTHONPATH, and try to uninstall it with pip, e.g.:

> git clone -q --depth 1 https://github.com/python-xlib/python-xlib.git
> (cd python-xlib && python setup.py -q egg_info)
> PYTHONPATH=python-xlib pip uninstall python-xlib; echo $?
Can't uninstall 'python-xlib'. No files were found to uninstall.
0

benoit-pierre avatar Mar 17 '18 09:03 benoit-pierre

Duplicate issue: https://github.com/pypa/pip/issues/4737

drunkwcodes avatar Mar 27 '18 15:03 drunkwcodes

#4737 is specifically about pip install with no arguments, although it expanded into discussion of the general case of what the exit code should be in various cases.

I'm not sure there's anything actionable from general discussions of principles. We'd be happy to consider PRs offering specific fixes - or indeed specific bug reports for individual cases such as this one.

In this case, the description is about uninstall whereas the title is about install. @benoit-pierre can I assume it's the title that's wrong? I'm happy for this to remain open as a separate issue (and indeed to look at a PR fixing it if anyone wants to provide one ;-))

pfmoore avatar Mar 27 '18 16:03 pfmoore

Yes, uninstall!

benoit-pierre avatar Mar 27 '18 16:03 benoit-pierre

This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow. See the discussion above to understand what the desired fix is.

If there is not a corresponding pull request for this issue, it is up for grabs. For directions for getting set up, see our Getting Started Guide. If you are working on this issue and have questions, feel free to ask them here.

If you've already contributed to pip, work on another issue without this label instead.

pradyunsg avatar Oct 07 '22 14:10 pradyunsg

@pradyunsg, I'ld love to contribute for this fix.

darshanip avatar Oct 14 '22 20:10 darshanip

Is this issue still relevant, I want to contribute @pradyunsg. If not, no worries. Cheers!!

mahim37 avatar Jan 08 '23 14:01 mahim37

Update: I've restarted working on this. #11520

darshanip avatar Apr 25 '23 08:04 darshanip

It's still open, so I'll start working on it.

BenzhaminKim avatar Nov 23 '23 14:11 BenzhaminKim

PR is created, but needs a review. @BenzhaminKim

darshanip avatar Nov 23 '23 14:11 darshanip

PR is created, but needs a review. @BenzhaminKim

CI test from your PR hasn't been passed yet. You need to fix it.

BenzhaminKim avatar Nov 23 '23 14:11 BenzhaminKim

https://github.com/pypa/pip/pull/10176#pullrequestreview-713376922 @uranusjr Are you sure you want to return fail exit code when it fails to uninstall with only existing packages?

> git clone -q --depth 1 https://github.com/python-xlib/python-xlib.git
> (cd python-xlib && python setup.py -q egg_info)
> PYTHONPATH=python-xlib pip uninstall python-xlib; echo $?
Can't uninstall 'python-xlib'. No files were found to uninstall.
0

It gives No files were found logs. Then it seems correct exit code if you want to return success exit code when trying to uninstall not existing packages.

BenzhaminKim avatar Nov 23 '23 15:11 BenzhaminKim

Has this issue been fixed? I'd like to work on this

Infamous003 avatar May 15 '25 10:05 Infamous003