This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bdist_wininst uninstaller does not remove pycache directories
Type: behavior Stage: resolved
Components: Distutils, Windows Versions: Python 3.4, Python 3.5
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Matt.Wilkie, eric.araujo, mhammond, paul.moore, tarek, vstinner
Priority: normal Keywords: patch

Created on 2011-10-07 15:22 by paul.moore, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
bdist_wininst-pycache-removal.diff eric.araujo, 2012-02-11 04:44 review
Messages (12)
msg145090 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-07 15:22
When uninstalling a package installed using a bdist_wininst installer, the uninstall reports "XXX files and directories could not be removed". The problem appears to be the __pycache__ directories introduced in Python 3.2, which are not removed properly.
msg145097 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-07 16:21
Thanks for the report.  Are you familiar with the bdist_wininst code?  I am not (yet), so if you could make a patch it would help a lot.

See also #11254 (which I will commit shortly).
msg145124 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-07 18:55
Not really (tbh, not at all). If I get some spare time, I can have a
look at producing a patch, but I have little time available for coding
at the moment (and I'm switching constantly between 3 PCs, so never
have a working development environment when I need one :-() If I get
anything workable before you do, I'll post it here.
msg145208 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-09 03:21
I don’t have a Windows VM set up yet, but I can try to write a patch in the coming weeks and ask you to test it.  Deal?
msg145235 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-09 07:44
On 9 October 2011 04:21, Éric Araujo <> wrote:
> Éric Araujo <> added the comment:
> I don’t have a Windows VM set up yet, but I can try to write a patch in the coming weeks and ask you to test it.  Deal?

No problem there!
msg152964 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2012-02-09 16:47
Have you had a chance to look at this yet?
msg153009 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-10 03:42
No, I worked on other things in my Python time.  I did get a Windows image, but failed to configure the VM*.  I’ve found some doc and will try again, or go back to the idea of giving you a patch to test.

  * (It gives a BSOD at boot, so one could argue that it counts as “working”
  for Windows :)
msg153090 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-11 04:44
So I had a quick look at the code and found the lines in need of a fix.  The problem comes as usual from our friend “path + optimize and 'o' or 'c'”.  I can read some C, so I tried to replace that with imp.cache_from_source, but a real C programmer should take it from here, especially if they find themselves on Windows so that they can recompile the wininst*.exe file and test the fix :)
msg153117 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2012-02-11 09:55
I'll try to take a look over the next couple of days.
msg224348 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-30 21:46
Just a gentle reminder.
msg224350 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2014-07-30 21:56
I'm not sure how relevant this is any more, as pip is the preferred installer these days and it cleanly uninstalls projects. At least for my usage, I no longer use wininst installers at all. I won't close this myself, though, as the issue still exists. But I won't object if it is closed as "wontfix".
msg384816 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-11 12:50
The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57332
2021-01-11 12:50:57vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg384816

resolution: wont fix
stage: needs patch -> resolved
2019-04-26 20:15:24BreamoreBoysetnosy: - BreamoreBoy
2014-07-30 21:56:08paul.mooresetmessages: + msg224350
2014-07-30 21:46:32BreamoreBoysetnosy: + BreamoreBoy

messages: + msg224348
versions: + Python 3.4, Python 3.5, - Python 3.3
2013-06-01 06:14:17Matt.Wilkiesetnosy: + Matt.Wilkie
2012-02-11 09:55:34paul.mooresetmessages: + msg153117
2012-02-11 04:44:19eric.araujosetfiles: + bdist_wininst-pycache-removal.diff

nosy: + mhammond
messages: + msg153090

keywords: + patch
2012-02-10 03:42:04eric.araujosetassignee: tarek -> eric.araujo
messages: + msg153009
2012-02-09 16:47:58paul.mooresetmessages: + msg152964
2011-10-09 07:44:59paul.mooresetmessages: + msg145235
2011-10-09 03:21:20eric.araujosetmessages: + msg145208
stage: needs patch
2011-10-07 18:55:34paul.mooresetmessages: + msg145124
2011-10-07 16:21:28eric.araujosetmessages: + msg145097
2011-10-07 15:22:39paul.moorecreate