How to uninstall python package in win10 - python

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.

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

Python : py and pip commands [duplicate]

What is the difference between:
pip install --upgrade pip
and
python -m pip install --upgrade pip
and why is python -m pip install --upgrade pip generally favoured?
The difference is between pip and python -m pip; the rest of the command doesn't matter. The reason to prefer the latter is that you're ensuring that the python you normally use is the one which will provide the pip module you invoke. Otherwise, there is a risk that the pip executable found in your PATH is from an unrelated or out of date Python installation; it might install packages, but your regular python invocation won't find them (because they're installed for a non-default Python).
You can also modify the second command to invoke specific Python executable names (python2.7 vs. python3.8), or even absolute paths if you might have versions with the same name installed in multiple places.
The first one
pip install --upgrade pip
is to invoke pip as a command. The actual python interpretor called is not explicit. The second one is calling the python interpretor explicitly, so you know which one is called.
There should be no difference, as the __main__.py in the module and the pip script are both point to the same entry point, unless in the case that the default python is different from the one used by the pip script
If i am correct, pip install --upgrade pip and python -m pip install --upgrade pip are the same unless you specify the pip or python version.
The latter is preferred because it attempts to upgrade the pip associated with the specified python version (e.g. python3.7 -m pip install --upgrade pip) even if the main python version is different (python command may refer to any python version).

Downgrading python package installed locally

In the server that work in (as do many other people) the "global" python has a certain version of a package, say 1.0.0.
I recently used pip to upgrade that to 1.0.2 locally for my user with the pip install --user package==1.0.2, which worked. However, now I want to uninstall my locally installed version and remain with the global one.
I've tried pip uninstall --user package==1.0.2, pip uninstall --user package, and a few other options but nothing seems to work. I always get this error:
Usage:
pip <command> [options]
no such option: --user
I also tried pip install --user package=1.0.0 but now I have both versions installed locally and python uses the most recent.
How can I do what I want?
Apparently this cannot be done with pip directly. I ended up solving it just by removing the package from ~/.local/lib/python3.5/site-packages/. A bit more manual than I was hoping I'd have to do.
The --user option for pip seems to have been removed but is still an option with setuptools.
So if you want to use the --user function what you can do is use pip download which will download the .whl file. You then need to extract the file using wheel unpack. I then ran python setup.py install --user (worked for numpy) and it installed the package to my home directory under .local.
I followed the documentation here.

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.

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