[Distutils] Unable to write into TMP directory during installation

P.J. Eby pje at telecommunity.com
Tue Oct 26 22:05:11 CEST 2010


At 09:29 AM 10/26/2010 +0300, anatoly techtonik wrote:
>Hello,
>
>How come that packages are unable to write into TEMP directory during
>installation?

Because projects that write anything outside of distutils-defined 
directories are breaking the implicit contract of a distutils-based 
installation, and that means that easy_install cannot guarantee that 
the installation will proceed correctly.  That is why the message 
says the package "cannot be safely installed by EasyInstall".

(I suppose it could say instead that EasyInstall cannot be sure 
whether installation is safe, and is thus refusing the temptation to 
guess, but that would make the message a bit longer.)

In this specific case ("Gerald"), the package has two problems that 
are causing this error: first, it is trying to import the package 
before it is installed, and second, it writes files as a side-effect 
of this importing.  (The author seems to have tried to work around 
the usual consequences of the first problem, but that can't mitigate 
the second problem.)

While neither of these things is technically illegal, they are in the 
first case bad practice for installation, and in the second case, bad 
programming practice for a library.  ("Gerald" appears to be an 
application rather than a library, of course, but even so, an 
application shouldn't be started up before it's been installed -- 
especially not if it's writing files outside the build/install directory.)

All this being said -- a future version of easy_install could (and 
perhaps should) reset TEMP/TMP in the installation sandbox to 
something that's actually usable.


> >python -m easy_install gerald
>...
>Downloading 
>http://pypi.python.org/packages/source/g/gerald/gerald-0.4.1.zip#md5=1b29e97c0077282a26829693fb07dca1
>Processing gerald-0.4.1.zip
>Running gerald-0.4.1\setup.py -q bdist_egg --dist-dir
>c:\users\user\appdata\local\temp\easy_install-1jedvu\gerald-0.4.1\egg-dist-tmp-wg8yyn
>error: SandboxViolation:
>open('C:\\Users\\user\\AppData\\Local\\Temp\\gerald.log', 'a') {}
>
>The package setup script has attempted to modify files on your system
>that are not within the EasyInstall build area, and has been aborted.
>
>This package cannot be safely installed by EasyInstall, and may not
>support alternate installation locations even if you run its setup
>script by hand.  Please inform the package's author and the EasyInstall
>maintainers to find out if a fix or workaround is available.
>
>--
>anatoly t.
>_______________________________________________
>Distutils-SIG maillist  -  Distutils-SIG at python.org
>http://mail.python.org/mailman/listinfo/distutils-sig



More information about the Distutils-SIG mailing list