Pip How to Remove Incorrectly Installed Package with a Leading Dash: "-Pkgname"

pip how to remove incorrectly installed package with a leading dash: -pkgname

EDIT: According to this link, provided by Lawrence in his answer

looking for and deleting the incorrectly named folders in your site-package directory should solve the issue.

If this is not sufficient, continue the cleaning as explained below.

Searching for the name of the broken package (without the leading dash) allowed me to find the following two folders:

C:\Users\name\Anaconda3\Lib\site-packages~atplotlib

C:\Users\name\Anaconda3\Lib\site-packages~atplotlib-3.0.3-py3.7.egg-info

Following Hoefling's comment (below)

I checked the SOURCES.txt file in the egg-info directory %dir%/~atplotlib-3.0.3-py3.7.egg-info/SOURCES.txt. Went through the list of paths in this file and made sure all paths listed did not contained ~. Then I renamed the directory ~atplotlib-3.0.3-py3.7.egg-info into atplotlib-3.0.3-py3.7.egg-info (removed the tilde ~).

Finally, I ran pip uninstall atplotlib, which prompted the following:

Uninstalling atplotlib-3.0.3:

Would remove:

C:\Users\name\Anaconda3\Lib\site-packages\atplotlib-3.0.3-py3.7.egg-info
C:\Users\name\Anaconda3\Lib\site-packages\matplotlib

C:\Users\name\Anaconda3\Lib\site-packages\pylab.py

Proceeding with the removal solved the issue (the warning disappeared and the package is not anymore on the package list.

Unable to uninstall package named `-umpy`

Try

py -m pip uninstall -- -umpy

Double dashes separate options from non-options; used exactly in case like this.

BTW, I don't think -umpy is a real package. It seems it's a leftover from an unsuccessful uninstallation of a package numpy.

It could be you need to remove its directories manually. To do that, type py -m pip list -v to get a list of all installed modules together with their installation location and then simply delete the corresponding folders.

What are the - and -ip Python libraries and how can I delete them?

Ah! Looks like a corrupt site-packages directory

drwxr-xr-x    8 admin  admin    256 Sep 20  2020 urllib3-1.25.10.dist-info/
drwxr-xr-x 9 admin admin 288 Sep 20 2020 ~-p-20.2.3.dist-info/
drwxr-xr-x 9 admin admin 288 Sep 20 2020 ~ip-20.2.3.dist-info/

I'm guessing a simple rm will take care of the problem

PIP3 | WARNING: Could not generate requirement for distribution -ertifi 2019.11.28

So I was getting that same error but for a different package:

WARNING: Could not generate requirement for distribution -niso8601 8.0.0 (...) venv/lib/python3.6/site-packages): Parse error at "'-niso860'": Expected W:(abcd...)

It turned out to be a missing letter in my first package! I needed to have "aniso8601==7.0.0" I literally did a freeze from a different venv that had that same package I needed, copied and pasted into the requirements.txt in the new project's folder. The requirements.txt file in the new project then installed successfully.

TL;DR: My requirements.txt file had a typo.



Related Topics



Leave a reply



Submit