How uninstall pip3 - python

I am having some problems with pip when trying to install a python application.
It says its not able to find pip3, but its installed
Digging deeper I think I have locations where pip3 is installed.
While trying to uninstall, even that is not working since it referring to the other pip3
How to I go about keeping only one copy of pip3 and uninstall one copy of it
$which pip3
/home/frappeuser/.local/bin/pip3
$ sudo pip3 uninstall pip
sudo: unable to execute /usr/local/bin/pip3: No such file or directory

You can unninstall it using python in cmd using the following:
python3 -m pip uninstall pip
In case you are using python 2.0
python -m pip uninstall pip
python - refers to the python version that you are working with
-m - refers to the option module
pip - specifies the module name that you want to use
uninstall - the operation you want to do
pip - the module that you want to uninstall

/local/ means you have it installed not via package manager, so to uninstall it you have to provide the full path:
sudo /home/frappeuser/.local/bin/pip3 uninstall pip

Related

How to uninstall "pycrypto"?

how to uninstall pycrypto?
I got an error "ModuleNotFoundError: No module named 'Crypto' so I searched on Stack Overflow and someone said
"WARNING: Don't use pycrypto anymore!
Use pycryptodome instead, via pip3 install pycryptodome.
But make sure that you don't have pycrypto installed, because both packages install under the same folder Crypto."
So I'm looking to uninstall pycrypto
use pip list or conda list to see your installed packages.
From their you should be able to see the correct name of the package.
Afterwards you can use pip / conda uninstall *packagename*.
You can use the following commands to uninstall pycrypto:
pip freeze | grep pycrypto
# copy the output say, pycrypto==2.6.1 and run uninstall command.
pip uninstall pycrypto==2.6.1
Note: pip freeze will list all the installed python packages and grep will narrow it down to only pycrypto package
You can go in your python site-packages folder (or wherever your packages are installed) and simply delete them. pip uninstall should work too.
you can easily uninstall every pip package by using
python3 -m pip uninstall <package name>
or if pip shortcut is setup (most commonly)
pip uninstall <package name>
to get a package name you can run
pip list |grep <some filter>
the <some filter> is a query you want to search e.g. crypto
for your package it should be
pip uninstall pycrypto

How to uninstall python package in win10

I want to uninstall one package named fp_growth
so I use this operation in command:
python -m pip uninstall fp_growth
I also use:
python -m pip uninstall fp_growth pip3
but it shows same errors here.
how to solve it?
ERROR: Cannot uninstall 'fp-growth'. It is a distutils installed
project and thus we cannot accurately determine which files belong to
it which would lead to only a partial uninstall.
Try using this
python -m pip uninstall fp_growth
If you are using Python3 then replace pip by pip3
Have you tried python -m pip uninstall fp_growth to uninstall using pip?
The pip command, when used with python -m (or python3 -m) doesn't require a version modifier like it does when used standalone as pip uninstall fp_growth or pip3 uninstall fp_growth.
Go to C:\Users\ (Current User Name)\AppData\Local\Programs.
Delete Python Folder.
Go to Control Panel >> Uninstall a Program.
Right Click on Python and then Change/Modify.
Click on Repair Python. Note: This will Fail but be Patient.
Now Again go to step 3.
Now, after step 3, uninstall Python.

python: pip fails to install matplotlib v.3.1.1 [duplicate]

On Ubuntu 10.04 by default Python 2.6 is installed, then I have installed Python 2.7. How can I use pip install to install packages for Python 2.7.
For example:
pip install beautifulsoup4
by default installs BeautifulSoup for Python 2.6
When I do:
import bs4
in Python 2.6 it works, but in Python 2.7 it says:
No module named bs4
Alternatively, since pip itself is written in python, you can just call it with the python version you want to install the package for:
python2.7 -m pip install foo
Use a version of pip installed against the Python instance you want to install new packages to.
In many distributions, there may be separate python2.6-pip and python2.7-pip packages, invoked with binary names such as pip-2.6 and pip-2.7. If pip is not packaged in your distribution for the desired target, you might look for a setuptools or easyinstall package, or use virtualenv (which will always include pip in a generated environment).
pip's website includes installation instructions, if you can't find anything within your distribution.
You can execute pip module for a specific python version using the corresponding python:
Python 2.6:
python2.6 -m pip install beautifulsoup4
Python 2.7
python2.7 -m pip install beautifulsoup4
In Windows, you can execute the pip module by mentioning the python version ( You need to ensure that the launcher is on your path )
py -2 -m pip install pyfora
You can use this syntax
python_version -m pip install your_package
For example. If you're running python3.5, you named it as "python3", and want to install numpy package
python3 -m pip install numpy
Have tried this on a Windows machine and it works
If you wanna install opencv for python version 3.7, heres how you do it!
py -3.7 -m pip install opencv-python
Alternatively, if you want to install specific version of the package with the specific version of python, this is the way
sudo python2.7 -m pip install pyudev=0.16
if the "=" doesnt work, use ==
x#ubuntuserv:~$ sudo python2.7 -m pip install pyudev=0.16
Invalid requirement: 'pyudev=0.16'
= is not a valid operator. Did you mean == ?
x#ubuntuserv:~$ sudo python2.7 -m pip install pyudev==0.16
works fine
If you have both 2.7 and 3.x versions of python installed, then just rename the python exe file of python 3.x version to something like - "python.exe" to "python3.exe". Now you can use pip for both versions individually. If you normally type "pip install " it will consider the 2.7 version by default. If you want to install it on the 3.x version you need to call the command as "python3 -m pip install ".
Python 2
sudo pip2 install johnbonjovi
Python 3
sudo pip3 install johnbonjovi
For Python 3
sudo apt-get install python3-pip
sudo pip3 install beautifulsoup4
For Python 2
sudo apt-get install python2-pip
sudo pip2 install beautifulsoup4
On Debian/Ubuntu, pip is the command to use when installing packages
for Python 2, while pip3 is the command to use when installing
packages for Python 3.
for python2 use:
py -2 -m pip install beautifulsoup4
I faced a similar problem with another package called Twisted. I wanted to install it for Python 2.7, but it only got installed for Python 2.6 (system's default version).
Making a simple change worked for me.
When adding Python 2.7's path to your $PATH variable, append it to the front like this: PATH=/usr/local/bin:$PATH, so that the system uses that version.
If you face more problems, you can follow this blog post which helped me - https://github.com/h2oai/h2o-2/wiki/installing-python-2.7-on-centos-6.3.-follow-this-sequence-exactly-for-centos-machine-only
As with any other python script, you may specify the python installation you'd like to run it with. You may put this in your shell profile to save the alias. The $1 refers to the first argument you pass to the script.
# PYTHON3 PIP INSTALL V2
alias pip_install3="python3 -m $(which pip) install $1"
I'm using Ubuntu 22.04, which comes with python 3.10.4.
Some packages do not have recent pip packages, so I needed install from an older pip. This sequence worked for me.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.9
sudo apt install python3.9-distutils
python3.9 -m pip install onnxruntime-gpu
Folder location: /usr/local/lib/python3.8
Package: python3.8 -m pip install <package_name>
I had Python 2.7 installed via chocolatey on Windows and found pip2.7.exe in C:\tools\python2\Scripts.
Using this executable instead of the pip command installed the correct module for me (requests for Python 2.7).
I think the best practice here is not to use the system python or install any system python package (no apt install). That is just the way to trouble.
Instead, build the required Python version from source, get it installed in /usr/local/... . Then use pip to install packages for that. It is really not that hard to build Python from source on Ubuntu.
sudo apt install build-essential
download the source from https://www.python.org/downloads/source/
unpack the file downloaded: tar xf <filename>
cd <directory> - change into the directory created.
./configure
make
sudo make install
Then check /usr/local/bin for a pip script tied to that version. Use that to pip install whatever you need. Also find the particular executable for the python version in that directory. You might have to shuffle things a bit if you get lots of versions.
Again, do not mess with system python.

pip is rolling back

I have a problem with the pip python 3.x installation.
I have pip version 19.0.3, but when i use pycharm, it keeps saying that i need the pip updated.
when i check the folder, I can see there is another version of pip pip-10.0.1-py3.7.egg in the folder.
I remember ticking the option to add the python in the environment path when i installed python.
When I tried to update/install pip again, i got the error.
(venv) C:\Users\ranic\PycharmProjects\ProjectDatabase>pip help install
You are using pip version 10.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(venv) C:\Users\r\PycharmProjects\ProjectDatabase>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\r\pycharmprojects\projectdatabase\venv\lib\site-packages (19.0.3)
Thank you in advance.
If you check, I guarantee that pip is not in the same place as python.
Mine are, seen below:
C:\Users\adsmith>where pip
C:\Users\adsmith\AppData\Local\Programs\Python\Python36-32\Scripts\pip.exe
C:\Users\adsmith>where python
C:\Users\adsmith\AppData\Local\Programs\Python\Python36-32\python.exe
but I'm guessing your python is referring to Python2, and pip Python3 (or vice versa). If you find the version of Python that pip refers to, you should be able to do:
path/to/that/python -m pip install --upgrade pip

Install a module using pip for specific python version

On Ubuntu 10.04 by default Python 2.6 is installed, then I have installed Python 2.7. How can I use pip install to install packages for Python 2.7.
For example:
pip install beautifulsoup4
by default installs BeautifulSoup for Python 2.6
When I do:
import bs4
in Python 2.6 it works, but in Python 2.7 it says:
No module named bs4
Alternatively, since pip itself is written in python, you can just call it with the python version you want to install the package for:
python2.7 -m pip install foo
Use a version of pip installed against the Python instance you want to install new packages to.
In many distributions, there may be separate python2.6-pip and python2.7-pip packages, invoked with binary names such as pip-2.6 and pip-2.7. If pip is not packaged in your distribution for the desired target, you might look for a setuptools or easyinstall package, or use virtualenv (which will always include pip in a generated environment).
pip's website includes installation instructions, if you can't find anything within your distribution.
You can execute pip module for a specific python version using the corresponding python:
Python 2.6:
python2.6 -m pip install beautifulsoup4
Python 2.7
python2.7 -m pip install beautifulsoup4
In Windows, you can execute the pip module by mentioning the python version ( You need to ensure that the launcher is on your path )
py -2 -m pip install pyfora
You can use this syntax
python_version -m pip install your_package
For example. If you're running python3.5, you named it as "python3", and want to install numpy package
python3 -m pip install numpy
Have tried this on a Windows machine and it works
If you wanna install opencv for python version 3.7, heres how you do it!
py -3.7 -m pip install opencv-python
Alternatively, if you want to install specific version of the package with the specific version of python, this is the way
sudo python2.7 -m pip install pyudev=0.16
if the "=" doesnt work, use ==
x#ubuntuserv:~$ sudo python2.7 -m pip install pyudev=0.16
Invalid requirement: 'pyudev=0.16'
= is not a valid operator. Did you mean == ?
x#ubuntuserv:~$ sudo python2.7 -m pip install pyudev==0.16
works fine
If you have both 2.7 and 3.x versions of python installed, then just rename the python exe file of python 3.x version to something like - "python.exe" to "python3.exe". Now you can use pip for both versions individually. If you normally type "pip install " it will consider the 2.7 version by default. If you want to install it on the 3.x version you need to call the command as "python3 -m pip install ".
Python 2
sudo pip2 install johnbonjovi
Python 3
sudo pip3 install johnbonjovi
For Python 3
sudo apt-get install python3-pip
sudo pip3 install beautifulsoup4
For Python 2
sudo apt-get install python2-pip
sudo pip2 install beautifulsoup4
On Debian/Ubuntu, pip is the command to use when installing packages
for Python 2, while pip3 is the command to use when installing
packages for Python 3.
for python2 use:
py -2 -m pip install beautifulsoup4
I faced a similar problem with another package called Twisted. I wanted to install it for Python 2.7, but it only got installed for Python 2.6 (system's default version).
Making a simple change worked for me.
When adding Python 2.7's path to your $PATH variable, append it to the front like this: PATH=/usr/local/bin:$PATH, so that the system uses that version.
If you face more problems, you can follow this blog post which helped me - https://github.com/h2oai/h2o-2/wiki/installing-python-2.7-on-centos-6.3.-follow-this-sequence-exactly-for-centos-machine-only
As with any other python script, you may specify the python installation you'd like to run it with. You may put this in your shell profile to save the alias. The $1 refers to the first argument you pass to the script.
# PYTHON3 PIP INSTALL V2
alias pip_install3="python3 -m $(which pip) install $1"
I'm using Ubuntu 22.04, which comes with python 3.10.4.
Some packages do not have recent pip packages, so I needed install from an older pip. This sequence worked for me.
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.9
sudo apt install python3.9-distutils
python3.9 -m pip install onnxruntime-gpu
Folder location: /usr/local/lib/python3.8
Package: python3.8 -m pip install <package_name>
I had Python 2.7 installed via chocolatey on Windows and found pip2.7.exe in C:\tools\python2\Scripts.
Using this executable instead of the pip command installed the correct module for me (requests for Python 2.7).
I think the best practice here is not to use the system python or install any system python package (no apt install). That is just the way to trouble.
Instead, build the required Python version from source, get it installed in /usr/local/... . Then use pip to install packages for that. It is really not that hard to build Python from source on Ubuntu.
sudo apt install build-essential
download the source from https://www.python.org/downloads/source/
unpack the file downloaded: tar xf <filename>
cd <directory> - change into the directory created.
./configure
make
sudo make install
Then check /usr/local/bin for a pip script tied to that version. Use that to pip install whatever you need. Also find the particular executable for the python version in that directory. You might have to shuffle things a bit if you get lots of versions.
Again, do not mess with system python.

Categories