Skip to content

Windows installer created with Python X.Y does not work with Python X.Y+1 #49168

Closed

Description

@rantanen
mannequin
BPO 4918
Nosy @loewis, @pfmoore, @tjguk, @tarekziade, @merwok, @zware, @eryksun, @zooba, @dstufft
Superseder
  • bpo-4566: 2.6.1 breaks many applications that embed Python on Windows
  • Files
  • simple.zip: Simple project
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tarekziade'
    closed_at = <Date 2015-09-25.03:15:07.725>
    created_at = <Date 2009-01-12.05:28:22.051>
    labels = ['type-bug', 'library', 'OS-windows']
    title = 'Windows installer created with Python X.Y does not work with Python X.Y+1'
    updated_at = <Date 2015-09-25.03:15:07.716>
    user = 'https://bugs.python.org/rantanen'

    bugs.python.org fields:

    activity = <Date 2015-09-25.03:15:07.716>
    actor = 'eryksun'
    assignee = 'tarek'
    closed = True
    closed_date = <Date 2015-09-25.03:15:07.725>
    closer = 'eryksun'
    components = ['Distutils', 'Windows']
    creation = <Date 2009-01-12.05:28:22.051>
    creator = 'rantanen'
    dependencies = []
    files = ['12694']
    hgrepos = []
    issue_num = 4918
    keywords = []
    message_count = 8.0
    messages = ['79647', '79648', '79649', '153678', '153691', '153694', '251553', '251566']
    nosy_count = 12.0
    nosy_names = ['loewis', 'paul.moore', 'tim.golden', 'tarek', 'eric.araujo', 'rantanen', 'alexis', 'BreamoreBoy', 'zach.ware', 'eryksun', 'steve.dower', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '4566'
    type = 'behavior'
    url = 'https://bugs.python.org/issue4918'
    versions = ['Python 2.7', 'Python 3.2']

    Activity

    1. rantanen commented on Jan 12, 2009

      rantanenmannequin
      MannequinAuthor
      1. Create Windows installer with Python 2.5 from attached project.
      2. Install it with Python 2.6.1.
      3. The post-installer will fail with error message:
        *** run_installscript: internal error 0xFFFFFFFF ***

      The code causing this is:

      import socket

      and the actual error is:

      ImportError
      DLL load failed: The specified module could not be found.
      File "<string>", line 6, in windows_binary_install
      File "c:\apps\python26\lib\socket.py", line 46, in <module>
      import _socket

      If the installer is created with Python 2.6.1, it works fine.

      The problem was noticed in the Robot Framework project and the issue can
      be found from http://code.google.com/p/robotframework/issues/detail?id=196.

      This problem was first asked as part of issue
      http://bugs.python.org/issue4566, but Martin v. Löwis recommended to
      open new issue for this.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Jan 12, 2009
    3. loewis commented on Jan 12, 2009

      loewismannequin
      Mannequin

      Was the 2.6 installation "for all users", or "just for me"? What Windows
      version are you using?

    4. rantanen commented on Jan 12, 2009

      rantanenmannequin
      MannequinAuthor

      Python 2.6.1 was installed with option all users. I have admin rights
      and the Windows version is:
      XP Professional
      Version 2002
      Service Pack 3

    5. added
      type-crashA hard crash of the interpreter, possibly with a core dump
      on Mar 1, 2009
    6. added
      type-bugAn unexpected behavior, bug, or error
      and removed
      type-crashA hard crash of the interpreter, possibly with a core dump
      on Feb 9, 2010
    7. merwok commented on Feb 19, 2012

      @merwok
      Member

      Not sure if there is much to be done here; I don’t know if it is a reasonable expectation that an installer created with 2.X still work with 2.X+1, and anyway only 2.7 could get a bugfix now.

    8. changed the title [-]Windows installer created with Python 2.5 does not work with Python 2.6.1[/-] [+]Windows installer created with Python 2.5 does not work with Python 2.6.1[/+] on Feb 19, 2012
    9. loewis commented on Feb 19, 2012

      loewismannequin
      Mannequin

      Installers "ought to" work for subsequent versions if they contain pure-Python packages (i.e. no extension modules). I agree that the issue is obsolete for 2.x, but it may still exist for 3.x.

    10. merwok commented on Feb 19, 2012

      @merwok
      Member

      Thanks, keeping it open. If I manage to get a VM set up I will see if this is reproducible.

    11. changed the title [-]Windows installer created with Python 2.5 does not work with Python 2.6.1[/-] [+]Windows installer created with Python X.Y does not work with Python X.Y+1[/+] on Feb 19, 2012
    12. BreamoreBoy commented on Sep 24, 2015

      BreamoreBoymannequin
      Mannequin

      Can this be closed as history with so many changes having been made to the installer for 3.5?

    13. eryksun commented on Sep 25, 2015

      @eryksun
      Contributor

      There haven't been any fundamental changes to bdist_wininst in years, and bdist_wheel has mostly replaced it nowadays.

      I'm fairly certain this issue was fixed by Mark Hammond's fix for bpo-4566. Just to be certain, I updated the code to use print as a function and used 3.4 to build "Simple-Python 3.4.3.win-amd64.exe". I installed this to 3.5, and the post-install script ran successfully. So I'm re-tagging this issue for versions 2.7 and 3.2 and closing it as a duplicate.

      In summary, Python built with VS 2008 needs an activation context for the CRT assembly, which is required to load msvcr90.dll. Normally this comes from the application executable, such as python.exe. But when Python is embedded, it may be the case that the application lacks the required activation context (e.g. a bdist_wininst installer created by Python 2.5). Mark Hammond's fix works around this problem by saving and reusing the activation context from when the Python DLL was loaded. This activation context is based on the DLL's resource #2 manifest, which includes the CRT assembly.

      One remaining problem for embedding Python 2.7 is accessing msvcr90.dll via ctypes. But it's ctypes! Just dynamically create an activation context.

    14. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    OS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions