Title: Windows Python installer rolls back when run under SYSTEM account (SCCM)
Type: behavior Stage:
Components: Installation, Windows Versions: Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: Mr B Jones, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-12-21 09:16 by Mr B Jones, last changed 2016-12-29 17:53 by steve.dower.

File name Uploaded Description Edit Mr B Jones, 2016-12-21 09:16 logs and install scripts/unattend.xml
Messages (5)
msg283726 - (view) Author: Mr B Jones (Mr B Jones) Date: 2016-12-21 09:16
When I try to use the Python 3.5 and later installer for windows to make an automated unattended install via SCCM, it seems to work, but some time later it rolls back leaving only a few files installed (seems to be pip.exe and friends).

I have attached all the Python installer logs from a test machine from the temp folder used by the SYSTEM account (%SystemRoot%\Temp).

Manually installing from an account which is a member of the Administrators group works fine (not for 800+ machines though).
msg284190 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-28 17:59
Thanks. I finally got a chance to look at these logs - apologies for taking some time.

It looks like some of the installs succeeded and others were then trying to modify the existing installation (I *think* this is why the unattend.xml file had no effect).

This has hit a particular known problem where a quiet per-machine install when one already exists will uninstall packages, rather than quickly exiting because it's already up to date. I haven't been able to figure out the cause before, but your logs have given me some more information to work with, so thank you :)

I don't see any problem here with the first installation, so provided you do not try to run it a second time, I think it should be fine. Perhaps you can add your own pre-check to the batch file or SCCM to skip it? Meanwhile, I'll try and figure out a good solution to the underlying issue.
msg284236 - (view) Author: Mr B Jones (Mr B Jones) Date: 2016-12-29 08:38
All those logs came from one machine. SCCM is usually really good at detecting the existence of an install by checking the package GUID in the windows installed database, but getting the right GUID when dealing with a non-msi install is sometimes hit and miss (with a pure MSI install, it just pulls everything out of the MSI automagically). It can also check for the existence of files/folders, and files with particular version numbers embedded in them (though windows seems to display these version number differently than SCCM sees them sometimes).

In this case I guess I got the wrong GUID, so it went on re-trying the install, and all bets were then off. Usually the easiest way to get this right if it isn't automatic from the MSI is install the package then look in the registry for an uninstall or modify string which looks like "msiexec /x {GUID HERE}", but if I remember correctly (and it has been a couple of weeks so I could be thinking of the wrong package), the python installer doesn't do that.

When I'm back in work (from 9th), I can try it again SCCM.

Thanks for all your assistance.
msg284237 - (view) Author: Mr B Jones (Mr B Jones) Date: 2016-12-29 08:40
Windows Installer database even (autocorrect got me on the work iPhone).
Thanks again,
msg284285 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-29 17:53
Does SCCM support dependency provider keys? If so, Python 3.6.0 and 3.5.3 and later will set one of these (see issue28846), which should make it easier to detect the whole bundle. Previous versions of 3.5 used a random GUID here.

I managed to reproduce the issue on a test machine by running a per-user install as admin, then the per-machine install. I tried a few ideas to treat the per-user and per-machine installs more distinctly, but nothing seems to work well. Most likely, I'll just have to add a more serious block when there's an existing install and prevent the second bad installation, though I haven't yet figured out how to do that.
Date User Action Args
2016-12-29 17:53:36steve.dowersetmessages: + msg284285
2016-12-29 08:40:27Mr B Jonessetmessages: + msg284237
2016-12-29 08:38:11Mr B Jonessetmessages: + msg284236
2016-12-28 23:21:32steve.dowersetassignee: steve.dower
2016-12-28 17:59:20steve.dowersetmessages: + msg284190
2016-12-21 09:16:25Mr B Jonescreate