Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PYWIN32 upgrade via pip -- Error cannot uninstall... installed by distutils...'

Now that pywin32 is available in pip, what's the smooth path for upgrading from an earlier (native MSI installed) version to the latest and greatest in PIP?

My PIP won't uninstall the older version, as noted below.

======= C:\Users\bobhy
> pip list
Package         Version
--------------- -------
. . .
pip             10.0.1
pywin32         221
. . .

======= C:\Users\bobhy
> pip install pywin32==223
Collecting pywin32==223
  Using cached https://files.pythonhosted.org/packages/9f/9d/f4b2170e8ff5d825cd4398856fee88f6c70c60bce0aa8411ed17c1e1b21f/pywin32-223-cp36-cp36m-win_amd64.whl
Installing collected packages: pywin32
  Found existing installation: pywin32 221
Cannot uninstall 'pywin32'. 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.
like image 384
BobHy Avatar asked Jun 30 '18 14:06

BobHy


People also ask

How do I uninstall pip pywin32?

You have to do what pip uninstall is for pip install for your msi installation (which I think is uninstall manually). Downgrade pip to 9.0. 2 ( pip install "pip<10" ), uninstall pywin32 ( pip uninstall -y pywin32 ), restore pip to 10.0 ( pip install pip --upgrade ).

How do I uninstall a pip package?

To use pip to uninstall a package locally in a virtual environment: Open a command or terminal window (depending on the operating system) cd into the project directory. pip uninstall <packagename>

How do I upgrade pywin32?

pywin32 download and URL display. pywin32 install (an older version to test upgrade later) pip test. pywin32 test (list pywin32 version using pywin32)


2 Answers

I had a similar issue: pywin32 was coming from ActivePython and I was trying to (unsuccessfully) install another module (win10toast for what matters) from pip and that that module has a dependency to pywin32.

The installation had the same issue.

The solution was to add --ignore-installed:

 pip install win10toast --ignore-installed 

Cheers

like image 99
Jean-Francois T. Avatar answered Nov 14 '22 21:11

Jean-Francois T.


The solution is to uninstall the MSI installation via Control Panel > Uninstall or Change Program. After that you can install via pip.

like image 26
Daniel F. Avatar answered Nov 14 '22 21:11

Daniel F.