# Issues

Issue #143 resolved

# easy_install opens new console - can't read the output

Marc 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

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.

Users reported that setuptools doesn’t have this problem.

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 :-()

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.

1. reporter

Yes, it is still there in distribute 0.6.35, Python 3.3, Windows 7. Any instructions what to do with this manifest? :)

2. reporter

It is really the "install" in the executable name. A rename disables the UAC request.

3. reporter

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?!

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)

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.

4. Include a launcher manifest for console scripts to prevent undesirable UAC elevation for scripts detected as installers (such as easy_install). Fixes #143.

→ <<cset be6f65eea9c1>>