On OS X 10.6.8, I uninstalled a package using (at least pip tells me so)
sudo pip uninstall pkg_name
but the package still shows up when I do
pip freeze
I try to do the uninstall command above again, and pip tells me the package is not installed.
What is the problem here? How do I verify whether the package is uninstalled or not? If so, can I refresh some sort of index of pip to get it corrected?
To use pip to uninstall a package locally in a virtual environment: Open a command or terminal window (depending on the operating system) cd into the project directory. pip uninstall <packagename>
As I said above, running pip freeze gives you a list of all currently installed dependencies, but that does mean all of them.
The difference between pip freeze and pip list is that: pip freeze outputs the installed by the user packages in a requirements format that can be used to generate a requirements. txt file. pip list outputs all installed packages, including editables.
pip freeze might seem very useful initially but it can mess up your project because of the following reasons: It dumps all the libraries installed in your project including dependencies and sub-dependencies in the requirements. txt file. It still misses out on the libraries that are not installed using pip.
I thought you may have two pip
binaries, and when you run as sudo
, your shell chooses the wrong one, at first. But it does not make any sense if you run it again as sudo
and pip
removed the package. Did you do exactly this?
If you did not run the same commands twice, you may have different pip
binaries running the uninstall and freeze. Check if the following two commands result in the same output:
$ sudo pip freeze
# ... sudo output
$ pip freeze
# ... normal output
Anyway, you can check if the package is installed using:
$ python -c 'import pkg_name' &> /dev/null && echo installed || echo not installed
There is no sort of refresh feature in pip
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With