Why can't pip uninstall pysqlite?
Asked Answered
P

3

19

I'm trying to remove pysqlite from my system using pip.

What I get doing so makes no sense:

$ pip uninstall pysqlite

The command worked, but watch this:

$ pip freeze
[...]
pysqlite==1.0.1

Let's try again

$ pip uninstall pysqlite
Can't uninstall 'pysqlite'. No files were found to uninstall.

Nop, seems removed but still show up in pip freeze

Now comes the fun

$ pip install pysqlite
Requirement already satisfied (use --upgrade to upgrade): pysqlite in /usr/lib/python2.6/dist-packages
Cleaning up...

Fair enough:

$ pip install -U pysqlite
[...]
error: command 'gcc' failed with exit status 1
[...]
Can't roll back pysqlite; was not uninstalled
[...]

I just don't get it. Why can't pip uninstall pysqlite?

Priorate answered 30/10, 2012 at 9:29 Comment(3)
pysqlite in /usr/lib/python2.6/dist-packages; is this on Ubuntu and do you have pysqlite installed with the Ubuntu package manager?Holding
This is on Debian 6, and I installed using pipPriorate
For Googlers: this happened to me because I'd installed the offending package with homebrew instead of pip.Domesticity
B
15

Go to your /usr/lib/python2.6/site-packages/pysqlite*.egg/ (or anywhere else you store your eggs in your python path) and look for the installed-files.txt file.

If it does not exists, pip will not be able to uninstall it, if it does, you remove all the files within and you're rid of pysqlite. And as Martijn suggests, you should also check if you did not install your package with another package manager.

If you don't have the installed-files.txt, and your package has not been installed through a third-part package manager, you shall look up where your egg is, and remove it from the python path. Usually, eggs also write files in the directory where they lay, so you should look for a pysqlite/ directory in the directory where lays pysqlite.egg.

Basutoland answered 30/10, 2012 at 9:36 Comment(3)
Thanks, the package was indeed in /usr/lib/python/2.6/dist-packages and that pointed me to the right direction.Priorate
If I find the .egg-link file (whichs points to /path/some/where) if I delete boths it's like pip uninstall?Newman
It should, but beware that sometimes a package can write in other places, and you might have stale files staying around.Basutoland
C
15

For the record, I was able to upgrade a package I was having this issue with by using the --ignore-installed flag, e.g.

 pip install python-dateutil --upgrade --ignore-installed
Casmey answered 23/2, 2017 at 6:16 Comment(0)
M
1

Just give another way.

I pip-installed ykdl which requires m3u8 and iso8601.

Then I wanted to uninstall them all, pip uninstall ykdl iso8601 m3u8.The ykdl and iso8601 were gone, but I couldn't uninstall the m3u8.And I saw it in pip list. I puzzled too.

Finally.When I tried to import m3u8, it failed and said 'needs iso8601'. So i installed iso8601, then uninstalled m3u8,iso8601 one by one. It worked

=====

It was on ubuntu. But on my Windows 10, I uninstalled iso8601 m3u8 ykdl step by step successfully. Exciting!

Magdeburg answered 24/2, 2017 at 14:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.