Our sysadmin has installed a package, so I can remove my local copy. I'd like to say
pip uninstall --user <package>
but pip uninstall does not support --user. (At least pip 1.5.4 on Linux doesn't.)
Is there an easy way to do this by hand, i.e., delete the directory that contains the package?
This was a known bug in pip
Ref : https://github.com/pypa/pip/issues/2094
As pip uninstall does not have --user option unlike pip install the question is if there even exists a way to uninstall package installed with pip install --user?
It is now cleared with a note
The packages mentioned in the ticket started working after they offered Wheel-based packages.
I have found that upgrading the package first will let you uninstall the package that you installed with --user option. For my case was elevated:
I have installed with command:
pip3 install --user elevate
When i try to uninstall i recieve the skip info:
Skipping elevate as it is not installed.
After many unsuccessfull commands i have found that i need to update the package first with:
pip3 install --user --upgrade elevated
Then i was able to successfully uninstall the elevate package:
pip3 uninstall elevated
Related
I'm confused by the intended pip usage. Pip comes installed with Python, which is great, but I get the following warnings when new versions come out:
WARNING: You are using pip version 21.1.1; however, version 21.1.3 is available.
You should consider upgrading via the '/usr/local/opt/python#3.8/bin/python3.8 -m pip install --upgrade pip' command.
I follow the instructions to install it using the command they gave. But then it uninstalls my existing pip and is not able to install the new version.
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.1.1
Uninstalling pip-21.1.1:
ERROR: Could not install packages due to an OSError: Cannot move the non-empty directory '/usr/local/lib/python3.8/site-packages/pip-21.1.1.dist-info/': Lacking write permission to '/usr/local/lib/python3.8/site-packages/pip-21.1.1.dist-info/'.
The pip command is now unrecognized, and the official documentation for upgrading pip suggests running:
python -m pip install -U pip
which gives the same permission error.
I Google this error, and found that the community highly advises to not sudo from these questions (this and this). They also advised pip3 install --upgrade pip --user which also gave the same error. The common consensus is to only install pip packages inside virtual environments, but I'm hesitant to have pip completely uninstalled.
So I got pip to install using sudo, but it's unclear whether I've inadvertently affected (or will affect future) system-wide installations, or how I'd check for these.
I don't understand why installing pip inside /usr/local/ requires sudo, and whether I should only be using pip exclusively inside virtual environments and never outside it
pip can be installed with sudo, into a folder that you don't have permissions to write to. However, it can install packages outside of that folder (and thus, into a folder you have write permissions). However, it is recommended that you don't install pip into a root folder, and instead install it into your home directory.
The command to install pip as root is
sudo apt-get install pip
It should then prompt you for your password. I recommend using sudo whenever you install something.
As far as I know:
pip install --upgrade pkg
does the same thing as:
pip uninstall pkg
pip install pkg
but now that I actually look through the docs (and pip --help), I can't seem to find any info that specifically confirms this assumption to be true.
Is there ever a difference in behavior/outcome between running pip install -U ... and running pip uninstall ... followed by pip install ...? Are there any circumstances where one workflow should be preferred over the other?
I think the only difference is that the --upgrade version will prompt you for compatibility issues and if you decline with n, it will not uninstall the previous version.
In the uninstall install option, you end up with not having that package should you choose to 'fail' your install part.
Im trying to install google assistant on my Raspberry Pi, but when I keep getting an error: pip is a package and cannot be directly executed
Instead of
pip [...]
Try doing
python -m pip [...]
Can't really help more without more info.
I think your version of pip is old. You need to upgrade it first, like this:
pip install -U pip
You may need to upgrade setuptools too:
pip install -U setuptools
Since google-assistant-library is available as a wheel, you need to install wheel too:
pip install wheel
I don't know if you can do that with Raspberry Pi, but I recommend you to used a virtualenv. That way, you have a fresh and isolated Python executable and a recent version of pip.
virtualenv your_proj
source your_proj/bin/activate
pip install wheel
pip install google-assistant-library
For newer version ie. using pip3:
pip3 install -U <<package name>>
I had the same problem.
I think it was an outcome of a failed
> .\python.exe -m pip install --upgrade pip
do to some environment misconfiguration.
So it first removed the existing version 10.0.1, and then the installation of the new version 22.3.1 failed, leaving me with no pip.
From official documentation, I ran
> .\python.exe -m ensurepip --upgrade
which restored the original pip 10.0.1.
Then I fixed the environment problem, and then again
> .\python.exe -m pip install --upgrade pip
I now have pip 22.3.1.
If, in my Travis CI build, I want to uninstall a package locally and install the PyPI version, how do I modify the .travis.yml script to automatically say "yes" to the pip uninstall packagename command?
As it stands right now, all I have is:
- pip uninstall packagename #remove local version
- pip install packagename #install the PyPI version
Looking into pip help uninstall you will see that it takes a --yes flag.
Also you could consider using pip install -U packagename.
That's it, I've some package installed using setuptools i.e. I ran the command python setup.py install from the package source.
My question is, how do I uninstall the package or upgrade it?
Install pip using easy_install:
easy_install pip
and then:
pip uninstall <package>
PS. Probably duplicate.