Issue #143 resolved

easy_install opens new console - can't read the output

Marc Schlaich avatarMarc Schlaich created an issue

Running "easy_install" opens a new console and closes it immediately after processing. I can't read any output.

Environment:

  • Windows7 x64
  • Python 2.6

The problem seems the UAC from Windows. Starting a console with admin rights solves this issue. But maybe there is a better workaround for?

Edit: Yes, it is definitely an UAC problem. See http://stackoverflow.com/questions/583755/elevating-privileges-for-uac-using-manifest-open-new-console-window

Comments (15)

  1. Robert Myers

    Another work around (if you don't have admin rights) is to execute the command with python like:

    > C:\Python26\python.exe \path\to\easy_install [ARGS]
    

    Then a new window is not opened and the output is displayed in your command prompt.

  2. Anonymous

    Thank god at last an answer that works with 2008 Server this page needs more google juice

  3. Paul Moore

    This looks like a manifest issue. To avoid needing elevation, you can embed a manifest with contents

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
      <v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3"> 
        <v3:security> 
          <v3:requestedPrivileges> 
            <v3:requestedExecutionLevel level="asInvoker" /> 
          </v3:requestedPrivileges> 
        </v3:security> 
      </v3:trustInfo> 
    </assembly>
    

    I can try to work out the necessary incantation to embed that into easy_install.exe if no-one else already knows how.

    The issue (AIUI) is that Windows assumes that executables with "install" or "patch" in the name are installers, and requires elevation by default (to secure older installers that weren't written to request elevation. Backward compatibility hacks gone mad :-()

  4. Paul Moore

    Hmm, I just tried to reproduce the issue, and it doesn't seem to be happening for me. So I can't really develop a fix, as I don't see the problem. But if the problem does still exist, the above manifest should work.

  5. Marc Schlaich

    Ok, I read a little bit: running

    mt.exe -manifest easy_install.exe.manifest -outputresource:easy_install.exe
    

    with the Manifest from above solves the problem. But I assume that "mt" is not available on every setup, so this is no general solution?!

  6. Jason Tan

    Paul Moore it really is backward compatibility hacks gone mad. Have a look at "Installer Detection Technology".

    The general solution is to do what setuptools does: include an external easy_install.exe.manifest file which sits next to easy_install.exe. (Search for _launcher_manifest in their easy_install.py.)

    The contents are pretty much the same as the manifest items listed above:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity version="1.0.0.0"
        processorArchitecture="X86"
        name="easy_install.exe"
        type="win32"/>
        <!-- Identify the application security requirements. -->
        <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
            </requestedPrivileges>
        </security>
        </trustInfo>
    </assembly>
    

    For existing installations:

    1. save the above as easy_install.exe.manifest in the Python Scripts directory
    2. force Windows to read the manifest by changing easy_install.exe's timestamp (essentially touch easy_install.exe)
  7. Jason R. Coombs

    This is very interesting. I'm only now looking into this issue. I didn't realize it was an ongoing issue, because it never affected me and I use console scripts in Python under distribute daily.

    After reading the references given, I see now the issue apparently only affects executables detected as installers (containing strings "like" 'install', 'setup', etc).

    Furthermore, it only affects 32-bit executables. Apparently, that's why I've never or only rarely encountered the issue, because I've been pretty dedicated to 64-bit for some time.

    Thanks to everyone for the great references and detail. I'll get this sorted shortly.

  8. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.