Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rantanen mannequin opened this issue Jan 12, 2009 · 8 comments
Closed

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

rantanen mannequin opened this issue Jan 12, 2009 · 8 comments
Assignees
Labels
OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rantanen
Copy link
Mannequin

rantanen mannequin commented Jan 12, 2009

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']

    @rantanen
    Copy link
    Mannequin Author

    rantanen mannequin commented Jan 12, 2009

    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.

    @rantanen rantanen mannequin added the stdlib Python modules in the Lib dir label Jan 12, 2009
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jan 12, 2009

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

    @rantanen
    Copy link
    Mannequin Author

    rantanen mannequin commented Jan 12, 2009

    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

    @akitada akitada mannequin added OS-windows type-crash A hard crash of the interpreter, possibly with a core dump labels Mar 1, 2009
    @akitada akitada mannequin assigned tarekziade Mar 1, 2009
    @briancurtin briancurtin added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Feb 9, 2010
    @merwok
    Copy link
    Member

    merwok commented Feb 19, 2012

    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.

    @merwok merwok 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 Feb 19, 2012
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 19, 2012

    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.

    @merwok
    Copy link
    Member

    merwok commented Feb 19, 2012

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

    @merwok merwok 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 Feb 19, 2012
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Sep 24, 2015

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

    @eryksun
    Copy link
    Contributor

    eryksun commented Sep 25, 2015

    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.

    @eryksun eryksun closed this as completed Sep 25, 2015
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants