Thursday, September 17, 2009

easy_install no longer easy on Vista

Since my Windows machine was upgraded from XP to Vista, managing Python packages has become absolutely horrible. Here's what I've puzzled out so far, with much wailing and gnashing of teeth:

1. No matter what rights your primary account has, you need to run easy_install from a Run as Administrator window - otherwise, easy_install runs in a separate window which pops up, flashes some feedback at you for a microsecond or so, then disappears, leaving you with absolutely no record of whether the install works and why. There doesn't seem to be any way to log the results to a file.

2. After installing any module that is deployed as an .egg into site-packages, you need to go and edit its permissions manually to give your account read privileges on the egg. (Giving your account privileges on the whole site-packages directory does not help.) Until you do, import newmodule will fail with ImportError: no module named newmodule on your account - but will succeed when run from a Run as Administrator window.

This is bad news. I fought my way through because I'm a dedicated Pythonista; how many Vista-using Py-curious are going to give up on Python because module installation now requires such hacks?

(Don't forget - Ohio LinuxFest registration ends tomorrow at noon! Move, move, move! You'll hurt my feelings if you don't go.)

9 comments:

Lee_B said...

It's true that the Administrator account doesn't have full privileges, but I'm pretty sure you can create a shortcut that runs a command prompt which DOES have full privileges, and will therefore not cause these authentication/authorization problems.

Paul Moore said...

Where do you have Python installed? This sounds somewhat like Vista's protection of the "Program Files" directory - which may mean that installing Python elsewhere would help.

However, Python installs by default to C:\Python26, so you'd have had to deliberately choose Program Files for this to be the problem.

I don't use easy_install, so I can't offer anything more specific, I'm afraid...

Catherine said...

Lee B:

... but then... run all my Python programs as a super-privileged account?

Paul:

No, it's just in c:\Python26.

Damien Lebrun said...

Very strangely you still need to answer that UAC dialog when using easy_install in virtual env.

ChrisW said...

Of course, you could just use buildout and then you wouldn't have any of these problems ;-)

Putting stuff in site packages is evil.

Frank Patz-Brockmann said...

I assume that you want to easy_install into a "private" Python installation.

Vista's UAC is quite paranoid about programs named similar to "install" or "setup", or even programs containing suspect words in their version resources. To fix that you'll need the Microsoft Application Compatibility Toolkit.

You can use that to create a "ACT" .sdb-database file, adding a "RunAsInvoker" fix for easy_install to it, and "apply" that database to your system's UAC settings. Weird.

Anonymous said...

have you tried SuRun?

swheatley said...

@Frank Patz-Brockmann: interesting, and good to know.

As someone who managed to skip Vista altogether, but is planning on using Windows 7 soon(ish) for development, does UAC still have the same problems?

Adam Pletcher said...

I quickly disabled UAC when I moved to Vista, and didn't look back. Way more trouble than it's worth.

There's also several hidden UAC gotchas, like COM servers/clients silently failing to connect if one of them is untrusted, etc.