How to uninstall "pycrypto"? - python

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

Related

How uninstall pip3

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

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.

Cannot uninstall 'pandas' (distutils installed project)

I have created a conda environment where I am installing all the stuff I need.
I already had installed the pandas library, but I need to upgrade it to the latest version.
However, when I try pip3 install --upgrade pandas I get the following error:
Found existing installation: pandas 0.15.2
Cannot uninstall 'pandas'. 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.
I have tried sudo apt-get remove pandas, but this get me a message saying that the pandas package cannot be found.
In case is relevant, I am in Ubuntu 16.04 and using python 3.6.3
Though I'm unable to reproduce the error, you can try:
1) Reduce version
pip install --upgrade --force-reinstall pip==18.0
Try to re-install package
pip install xxx --disable-pip-version-check
At last, recover the latest version for pip
pip install --upgrade pip
2) pip install -I==18.0 -r requirements.txt
3) Try removing manually from 'site-packages'
These solutions were found here

No module named google.protobuf

I am trying to run Google's deep dream. For some odd reason I keep getting
ImportError: No module named google.protobuf
after trying to import protobuf. I have installed protobuf using sudo install protobuf. I am running python 2.7 OSX Yosemite 10.10.3.
I think it may be a deployment location issue but i cant find anything on the web about it. Currently deploying to /usr/local/lib/python2.7/site-packages.
There is another possibility, if you are running a python 2.7.11 or other similar versions,
sudo pip install protobuf
is ok.
But if you are in a anaconda environment, you should use
conda install protobuf
Locating the google directory in the site-packages directory (for the proper latter directory, of course) and manually creating an (empty) __init__.py resolved this issue for me.
(Note that within this directory is the protobuf directory but my installation of Python 2.7 did not accept the new-style packages so the __init__.py was required, even if empty, to identify the folder as a package folder.)
...In case this helps anyone in the future.
In my case I
downloaded the source code, compiled and installed:
$ ./configure
$ make
$ make check
$ sudo make install`
for python I located its folder(python) under source code, and ran commands:
$ python setup.py build
$ python setup.py install'
Not sure if this could help you..
I got the same error message when I tried to use Tensor Flow. The solution was simply to uninstall Tensor Flow and protobuf:
$ sudo pip uninstall protobuf
$ sudo pip uninstall tensorflow
And reinstall it again: pip installation of Tensorflow. Currently, this is:
# Ubuntu/Linux 64-bit, CPU only:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py2-none-any.whl
when I command pip install protobuf, I get the error:
Cannot uninstall 'six'. 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.
If you have the same problem as me, you should do the following commands.
pip install --ignore-installed six
sudo pip install protobuf
According to your comments, you have multiply versions of python
what could happend is that you install the package with pip of anthor python
pip is actually link to script that donwload and install your package.
two possible solutions:
go to $(PYTHONPATH)/Scripts and run pip from that folder that way you insure
you use the correct pip
create alias to pip which points to $(PYTHONPATH)/Scripts/pip and then run pip install
how will you know it worked?
Simple if the new pip is used the package will be install successfully, otherwise the package is already installed
I installed the protobuf with this command:
conda install -c anaconda protobuf=2.6.1
(you should check the version of protobuf)
In my case, MacOS has the permission control.
sudo -H pip3 install protobuf
I had this problem to when I had a google.py file in my project files.
It is quite easy to reproduce.
main.py: import tensorflow as tf
google.py: print("Protobuf error due to google.py")
Not sure if this is a bug and where to report it.

How do I update a Python package?

I'm running Ubuntu 9:10 and a package called M2Crypto is installed (version is 0.19.1). I need to download, build and install the latest version of the M2Crypto package (0.20.2).
The 0.19.1 package has files in a number of locations including (/usr/share/pyshared and /usr/lib/pymodules.python2.6).
How can I completely uninstall version 0.19.1 from my system before installing 0.20.2?
The best way I've found is to run this command from terminal
sudo pip install [package_name] --upgrade
sudo will ask to enter your root password to confirm the action.
Note: Some users may have pip3 installed instead. In that case, use
sudo pip3 install [package_name] --upgrade
You might want to look into a Python package manager like pip. If you don't want to use a Python package manager, you should be able to download M2Crypto and build/compile/install over the old installation.
To automatically upgrade all the outdated packages (that were installed using pip), just run the script bellow,
pip install $(pip list --outdated | awk '{ print $1 }') --upgrade
Here, pip list --outdated will list all the out dated packages and then we pipe it to awk, so it will print only the names.
Then, the $(...) will make it a variable and then, everything is done auto matically. Make sure you have the permissions. (Just put sudo before pip if you're confused)
I would write a script named, pip-upgrade
The code is bellow,
#!/bin/bash
sudo pip install $(pip list --outdated | awk '{ print $1 }') --upgrade
Then use the following lines of script to prepare it:
sudo chmod +x pip-upgrade
sudo cp pip-upgrade /usr/bin/
Then, just hit pip-upgrade and voila!
Via windows command prompt, run: pip list --outdated
You will get the list of outdated packages.
Run: pip install [package] --upgrade
It will upgrade the [package] and uninstall the previous version.
To update pip:
py -m pip install --upgrade pip
Again, this will uninstall the previous version of pip and will install the latest version of pip.
Method 1: Upgrade manually one by one
pip install package_name -U
Method 2: Upgrade all at once (high chance rollback if some package fail to upgrade
pip install $(pip list --outdated --format=columns |tail -n +3|cut -d" " -f1) --upgrade
Method 3: Upgrade one by one using loop
for i in $(pip list --outdated --format=columns |tail -n +3|cut -d" " -f1); do pip install $i --upgrade; done
I think the best one-liner is:
pip install --upgrade <package>==<version>
Open Command prompt or terminal and use below syntax
pip install --upgrade [package]==[specific version or latest version]
For Example
pip install --upgrade numpy==1.19.1
How was the package originally installed? If it was via apt, you could just be able to do apt-get remove python-m2crypto
If you installed it via easy_install, I'm pretty sure the only way is to just trash the files under lib, shared, etc..
My recommendation in the future? Use something like pip to install your packages. Furthermore, you could look up into something called virtualenv so your packages are stored on a per-environment basis, rather than solely on root.
With pip, it's pretty easy:
pip install m2crypto
But you can also install from git, svn, etc repos with the right address. This is all explained in the pip documentation
pip install -U $(pip list --outdated | awk 'NR>2 {print $1}')
In Juptyer notebook, a very simple way is
!pip install <package_name> --upgrade
So, you just need to replace with the actual package name.
How can I completely uninstall version 0.19.1 from my system before
installing 0.20.2?
In order to uninstall M2Crypto use
pip uninstall M2Crypto
I need to download, build and install the latest version of the
M2Crypto package (0.20.2).
In order to install the latest version, one can use PyPi
pip install M2Crypto
To install the version 20.2 (an outdated one), run
pip install M2Crypto==0.20.2
Assuming one just wants to upgrade
pip install M2Crypto --upgrade # Or pip install M2Crypto -U
Notes:
Depending on one's Python version (here's how to find the version) one may use a different pip command. Let's say one is working with Python 3.7, instead of just using pip, one might use pip3.7.
Using sudo is considered unsafe.
Nowadays there are better practices to manage the development system, such as: virtual environments or development containers. The development containers allow one to put the entire development environment (be it modules, VS Code extensions, npm libraries,...) inside a Docker container. When the project comes to an end, one closes the container. There's no need to keep all of those requirements around in the computer for no reason. If you feel like reading more about it: Visual Studio Docs, Github.
Get all the outdated packages and create a batch file with the following
commands
pip install xxx --upgrade for each outdated packages
I.e.:
python -m pip install --proxy <proxyserver_name>:<port#> <pkg_name>
Remember to export the variables after setting them, to make them available to the outer shell session.
Windows:
Add to environment variables:
set HTTP_PROXY=<proxyserver_name>:<port#>
You might have to install the full python package first

Categories