Cannot uninstall 'pandas' (distutils installed project) - python

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

Related

pip install ppaquette-gym-doom

I wrote pip install ppaquette-gym-doom
and it gives me a
error: legacy:install-failure
I tried pip install gensim pip install dlib --pre python -m pip install --upgrade pillow
python -m pip install --upgrade pip and python -m pip isntall --upgrade wheel
those codes didnt solved my problem
I am not familiar with gym-doom but based on some quick research it looks like you are getting this error because "ppaquette-gym-doom" is an obsolete version. From the github page "Note: This environment is not maintained anymore, and uses an old version of VizDoom."
It seems like the new version is simply "pip install gym-doom". This will also require something called Vizdoom.
Again this is based on quick research. I have never used these libraries.

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

Install albumentations with custom opencv-python version using pip?

The albumentations package requires some version of opencv-python. From setup.py:
# If none of packages in first installed, install second package
CHOOSE_INSTALL_REQUIRES = [
(
("opencv-python>=4.1.1", "opencv-contrib-python>=4.1.1", "opencv-contrib-python-headless>=4.1.1"),
"opencv-python-headless>=4.1.1",
)
]
When I pip install, it seems to choose opencv-python-headless, which has a bug that prevents installation. (If you read the bug, it looks like I could install a different version of scikit-build, but that didn't seem to work.)
The workaround is to install a dev version of opencv-python, which I can with this line in requirements.txt:
git+https://github.com/opencv/opencv-python#5de8d66d454c8fd946ae17dcfcb285b16aa6049b
However, while installing albumentations, it decides to still install opencv-python-headless, presumably because the version number (installed from github) doesn't compare well.
How can I install albumentations and have it use my existing opencv-python install?
I installed pip-tools, and compiled the requirements for albumentation, and I've been messing with the file, but pip still follows dependencies for each package.
Can I use pip to install a package directly, without dependencies? Then I could do it one at a time, with the versions I want.
Hi I had a similar problem what have done is:
Install opencv-python using pip install opencv-python==4.5.5
Download albumentations from github
git checkout {albumentations_version} you want to install
Change in albumentations/setup.py opencv-python>=4.1.1 with opencv-python==4.5.5.64
Update pip. pip install pip --upgrade. My version is 22.1.2
pip install albumentations/
At the end i have albumentations 1.1.0 installed with opencv-python==4.5.5 and not the latest version of opencv.

pip refuses to upgrade

I currently have installed pip 8.1.2.
So I want to upgrade it to the latest version (9.0.1) and I execute:
sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 846kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)
And then at the end it suggests me to upgrade using the same exact instruction I already provided!
Am I doing anything wrong?
The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.
As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).
A (ugly) work-around is to use easy_install instead:
sudo easy_install -U pip
This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.
If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.
If above are not working, please try this it works(I had similar situations and this works):
download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded file: python get-pip.py
Above uninstalls the old version and install the latest ones.
Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.
pip install --user --upgrade pip
It'll only work for one user but for some use cases that is just peachy.

Trouble with installing pip 8.1.1 from 7.1.2

I'm having an issue with upgrading pip from 7.1.2 to 8.1.1. At first I downloaded Python 3.4 and installed pip from there but then noticed Python 3.5 was there so I downloaded that. When trying to use pip to install selenium it says You are using pip version 7.1.2 however 8.1.1 is available. I do "pip install --upgrade pip" then get an error. See attached screenshot.What do I do? Btw I'm on windows 8.1.enter image description here
Ok. It's working if I run cmd as an admin then do
python -m pip install --upgrade pip
In Mac, I ran:
sudo python -m pip install --upgrade pip
Then, it worked.
Did you try python -m pip install --upgrade pip? if pip is being used, it cannot install itself.
This is a common question that requires few germane steps to pre-installing other modules in Python.
Depending on the version of your Python (Either the 2.X series or the 3.X series), and the operation system (Window, Ubuntu, etc ), you will need to do the following;
Open CMD (Short-Cut: Control+R button on the keyboard)
Make sure the current directory is the administrator on the hard-drive of the system and your internet connection is available.
i.e C:\Users\System_Name PC
Type in the command:
Pip install --upgrade pip
i.e C:\Users\System_Name PC > pip install --upgrade pip
and hit ENTER key to activate:
It will uninstall the previous version and install the latest version
Restart the system and continue the installation of each python module
e.g Pip install dateutil
Pip install numpy
Pip install matplotlib
Peradventure you wish to specify the version of the python module dependencies you want to install;
Pip install Django==1.90
It will install the specific version: otherwise if not specified, the latest version of the target module would be installed.

Categories