Issue 7071: distutils and IronPython compatibility (original) (raw)

Created on 2009-10-06 11:11 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (9)

msg93640 - (view)

Author: Michael Foord (michael.foord) * (Python committer)

Date: 2009-10-06 11:11

distutils package installation isn't compatible with IronPython.

To reproduce first install IronPython 2.6 (RC1 is currently latest version) from the msi installer. This installs by default on Windows into "C:\Program Files\IronPython 2.6" and includes a "site-packages" folder in the "Lib" subfolder.

With the simplest Python package created with "python setup.py sdist" (CPython) from the first example in the distutils documentation I get the following on install:

C:\compile\test\foo-1.0>"C:\Program Files\IronPython 2.6\ipy.exe" setup.py install running install running build running build_py creating build creating build\lib copying foo.py -> build\lib running install_lib copying build\lib\foo.py -> C:\Program Files\IronPython 2.6\Lib\site-packages error: C:\Program Files\IronPython 2.6\Lib\site-packages\foo.py: None

C:\compile\test\foo-1.0>dir "C:\Program Files\IronPython 2.6\Lib\site-packages"

Volume in drive C has no label. Volume Serial Number is FC33-85DD

Directory of C:\Program Files\IronPython 2.6\Lib\site-packages

06/10/2009 11:37 . 06/10/2009 11:37 .. 15/09/2009 08:53 121 README.txt 1 File(s) 121 bytes 2 Dir(s) 71,854,129,152 bytes free

See also the following bug report against IronPython on the codeplex issue tracker. Here the distutils install fails in bytecode compilation.

http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24810

Bytecode compilation should not be attempted on IronPython as it does not use Python bytecode. ( sys.dont_write_bytecode is True )

The fixes should be backported to Python 2.6 if possible as IronPython 2.6 uses the standard library from SVN and will pick up changes even between releases.

msg93641 - (view)

Author: Michael Foord (michael.foord) * (Python committer)

Date: 2009-10-06 11:40

Hmmm... ok, so I was running on Vista where a normal user can't create files in the "Program Files" directory anyway. If I run with elevated permissions then I get the same error as reported on the IronPython issue on codeplex (which is probably what you will see if you try this on Windows XP):

C:\compile\test\foo-1.0>"C:\Program Files\IronPython 2.6\ipy.exe" setup.py install running install running build running build_py running install_lib copying build\lib\foo.py -> C:\Program Files\IronPython 2.6\Lib\site-packages byte-compiling C:\Program Files\IronPython 2.6\Lib\site-packages\foo.py to foo.p yc Traceback (most recent call last): File "setup.py", line 2, in setup.py File "C:\Program Files\IronPython 2.6\Lib\distutils\core.py", line 152, in set up File "C:\Program Files\IronPython 2.6\Lib\distutils\dist.py", line 975, in run _commands File "C:\Program Files\IronPython 2.6\Lib\distutils\dist.py", line 995, in run command File "C:\Program Files\IronPython 2.6\Lib\distutils\command\install.py", line 589, in run File "C:\Program Files\IronPython 2.6\Lib\distutils\cmd.py", line 333, in run command File "C:\Program Files\IronPython 2.6\Lib\distutils\dist.py", line 995, in run _command File "C:\Program Files\IronPython 2.6\Lib\distutils\command\install_lib.py", l ine 100, in run File "C:\Program Files\IronPython 2.6\Lib\distutils\command\install_lib.py", l ine 134, in byte_compile File "C:\Program Files\IronPython 2.6\Lib\distutils\util.py", line 535, in byt e_compile File "C:\Program Files\IronPython 2.6\Lib\py_compile.py", line 138, in compile

ValueError: unmarshallable object C:\compile\test\foo-1.0>

msg93727 - (view)

Author: Michael Foord (michael.foord) * (Python committer)

Date: 2009-10-07 22:13

So there are two issues here - the terrible error message when an install fails with an access denied error and the fact that distutils attempts to compile bytecode under IronPython.

msg94421 - (view)

Author: Tarek Ziadé (tarek) * (Python committer)

Date: 2009-10-24 14:41

Notice that install_lib has a --no-compile option that can be used to avoid compiling .pyc/.pyo files.

What I am adding now is just a gentle warning in case a compilation is tried and sys.dont_write_bytecode is True, so the installation may proceed nevertheless and it doesn't through an error.

For the 2.6 backport, it can be added in 2.6.5 I guess,

msg94505 - (view)

Author: Tarek Ziadé (tarek) * (Python committer)

Date: 2009-10-26 20:33

Done in trunk (r75669, and r75670 and r75671) and Py3k (r75704) and 3.1 (r75705).

I'll push in 2.6 when the branch is unfrozen.

Michael, could you create another issue for the access rights problems ? It'll be easier to track.

Thanks!

msg94552 - (view)

Author: Michael Foord (michael.foord) * (Python committer)

Date: 2009-10-27 12:36

This problem showed up when installing a package with IronPython, where the site-packages folder requires admin privileges to write to (which should be true with CPython Windows but isn't).

If you perform a 'python setup.py install' without admin privileges the install fails (as it should) but with a very cryptic error message:

C:\compile\test\foo-1.0>"C:\Program Files\IronPython 2.6\ipy.exe" setup.py install running install running build running build_py creating build creating build\lib copying foo.py -> build\lib running install_lib copying build\lib\foo.py -> C:\Program Files\IronPython 2.6\Lib\site-packages error: C:\Program Files\IronPython 2.6\Lib\site-packages\foo.py: None

msg94553 - (view)

Author: Michael Foord (michael.foord) * (Python committer)

Date: 2009-10-27 12:36

Sorry - meant to create a new issue.

msg97445 - (view)

Author: Tarek Ziadé (tarek) * (Python committer)

Date: 2010-01-08 23:28

merged in 2.6 in r77376

msg147229 - (view)

Author: Éric Araujo (eric.araujo) * (Python committer)

Date: 2011-11-07 15:26

I think this change was wrong. Please see my rationale in http://bugs.python.org/issue12119.

(BTW, I’d be surprised if byte compilation was the only compat issue with distutils and IronPython. For a start, sys.version[:3] is used to get the version number. I should be able to get Mono and IronPython in a few weeks or months and see how much issues there are in distutils and distutils2.)

History

Date

User

Action

Args

2022-04-11 14:56:53

admin

set

github: 51320

2011-11-07 15:26:57

eric.araujo

set

nosy: + eric.araujo
messages: +

2010-01-08 23:28:18

tarek

set

messages: +

2009-10-27 13:08:14

r.david.murray

set

nosy: + dino.viehland, brian.curtin

title: Unhelpful error message when a distutils package install fails due to a permissions error -> distutils and IronPython compatibility

2009-10-27 12:36:55

michael.foord

set

status: open -> closed

nosy: + tarek
messages: +

resolution: accepted

2009-10-27 12:36:02

michael.foord

set

status: closed -> open
title: distutils and IronPython compatibility -> Unhelpful error message when a distutils package install fails due to a permissions error
nosy: - tarek, dino.viehland, brian.curtin

messages: +

resolution: accepted -> (no value)

2009-10-26 20:33:21

tarek

set

status: open -> closed

messages: +

2009-10-24 14:41:07

tarek

set

priority: normal
resolution: accepted
messages: +

versions: + Python 3.1

2009-10-08 22:45:31

brian.curtin

set

nosy: + brian.curtin

2009-10-08 02:26:20

dino.viehland

set

nosy: + dino.viehland

2009-10-07 22:13:32

michael.foord

set

messages: +

2009-10-06 11:40:59

michael.foord

set

messages: +

2009-10-06 11:11:50

michael.foord

set

keywords: + 26backport

2009-10-06 11:11:42

michael.foord

create