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

2

7

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.
Script answered 30/6, 2018 at 14:19 Comment(4)
Can't you just uninstall the MSI?Ga
Isn't it kind of obvious? You have pywin32v221 installed as an msi, and you want to install pywin32v223 as a whl (which requires the old version to be uninstalled). pip doesn't know to install msis (and it shouldn't). You have to do what pip uninstall is for pip install for your msi installation (which I think is uninstall manually).Goodson
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).Unseat
pip install --ignore-installedIntegration
M
6

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

Microspore answered 31/8, 2018 at 13:57 Comment(0)
H
3

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

Hochstetler answered 5/7, 2018 at 21:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.