classification
Title: distutils does not show any error msg when can't build C module extensions due to a missing C compiler
Type: behavior Stage: resolved
Components: Distutils, Distutils2 Versions: Python 3.4, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: amaury.forgeotdarc, eric.araujo, giampaolo.rodola, jafo, loewis, python-dev, takluyver, tarek
Priority: normal Keywords: patch

Created on 2009-01-13 17:31 by giampaolo.rodola, last changed 2014-03-12 08:25 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
distutils_ioerror.patch amaury.forgeotdarc, 2009-01-14 10:25 review
Messages (15)
msg79751 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-01-13 17:31
Today I was trying to compile a module using an extension in C and
noticed there are differences between compiling it on Python 2.5 and 2.6.
I was trying to compile psutil (svn checkout
http://psutil.googlecode.com/svn/trunk/ psutil) but I think that the
problem may occur with any other package using C extensions.

Python 2.5:

D:\pyftpdlib\svn\psutil\trunk>C:\python25\python.exe setup.py install
running install
running build
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible
binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin
installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.



Python 2.6:

D:\pyftpdlib\svn\psutil\trunk>C:\python26\python.exe setup.py install
running install
running build
running build_ext
building 'psutil/_psutil_mswindows' extension
error: None
msg79767 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-01-13 18:52
What is the specific error you are reporting?
msg79769 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-01-13 18:57
Currently I haven't any C compiler installed on my system so I expect
distutils to report that every time I try to compile a C module extension.
Python 2.5 did that while Python 2.6 does not.
msg79845 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-01-14 10:25
The problem has two causes:
- IOError is raised when no compiler is found. DistutilsPlatformError
should be used instead, this was fixed by #4702.

- the distutils.util.grok_environment_error function transforms a
IOError("Unable to find vcvarsall.bat") into "error: None".

This function should not be used IMO. Its docstring claims that it
"Handles Python 1.5.1 and 1.5.2 styles", but str() does a better job...

Patch attached.
msg101389 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2010-03-20 18:42
Tarek: This patch seems reasonable to me, is this something that can be applied?
msg101390 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2010-03-20 19:51
I guess i can be applied on distutils, and backported in distutils2. I'll do it in the coming days.

Notice that I am now applying only bug fixes and regression fixes now for distutils.
msg117690 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-09-30 01:49
I will commit this if Tarek does not do it shortly.

In distutils2, I’ll remove grok_environment_error wholly, since it exists for 1.5 compat only.
msg120588 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-06 06:42
Giampaolo, can you test Amaury’s patch?  I’d prefer some testing before committing.
msg120611 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-11-06 12:12
I don't have the same setup I had at the time when I submitted the first message so maybe something has changed in meantime.
Below is what I get on Windows 2000 SP-3, no VS installed, python 2.7, before and after the patch.

C:\Documents and Settings\foo\Desktop\psutil>setup.py build
running build
running build_py
copying psutil\compat.py -> build\lib.win32-2.7\psutil
copying psutil\error.py -> build\lib.win32-2.7\psutil
copying psutil\_psbsd.py -> build\lib.win32-2.7\psutil
copying psutil\_pslinux.py -> build\lib.win32-2.7\psutil
copying psutil\_psmswindows.py -> build\lib.win32-2.7\psutil
copying psutil\_psosx.py -> build\lib.win32-2.7\psutil
copying psutil\_psposix.py -> build\lib.win32-2.7\psutil
copying psutil\__init__.py -> build\lib.win32-2.7\psutil
running build_ext
building '_psutil_mswindows' extension
error: Unable to find vcvarsall.bat


Although the message is improved ("Unable to find vcvarsall.bat" vs "None") it seems the patch had no effect.
msg212907 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-03-07 22:50
Any chance of getting this patch applied? It clearly makes the error message more useful, and we've run into another case where grok_environment_error gives the wrong result: when symlinking fails because the target exists, it now says "File exists: <source>", because e.filename is the source and e.filename2 the target.

It's also rather embarassing that a function in Python 3.4 still says "Handles Python 1.5.1 and 1.5.2 styles..." in the docstring.
msg212909 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-07 22:56
I want to make time for Python bugs again, so I’ll try and finish this bug soon.

See also msg200785 for a report from setuptools with an easy to reuse test case.
msg213207 - (view) Author: Roundup Robot (python-dev) Date: 2014-03-12 07:15
New changeset a865f6fb82b4 by Éric Araujo in branch '2.7':
Avoid “error: None” messages from distutils (#4931).
http://hg.python.org/cpython/rev/a865f6fb82b4
msg213208 - (view) Author: Roundup Robot (python-dev) Date: 2014-03-12 07:19
New changeset 0f1237b61f58 by Éric Araujo in branch '2.7':
Restore missing part of error message (#4931)
http://hg.python.org/cpython/rev/0f1237b61f58
msg213213 - (view) Author: Roundup Robot (python-dev) Date: 2014-03-12 08:11
New changeset 504eb00998f2 by Éric Araujo in branch '3.3':
Avoid “error: None” messages from distutils (#4931).
http://hg.python.org/cpython/rev/504eb00998f2

New changeset c7bd0f953687 by Éric Araujo in branch 'default':
Merge 3.3 (#4931)
http://hg.python.org/cpython/rev/c7bd0f953687
msg213219 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-12 08:25
Happy to close this as fixed.
History
Date User Action Args
2014-03-12 08:25:30eric.araujosetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg213219

stage: patch review -> resolved
2014-03-12 08:11:09python-devsetmessages: + msg213213
2014-03-12 07:19:45python-devsetmessages: + msg213208
2014-03-12 07:15:04python-devsetnosy: + python-dev
messages: + msg213207
2014-03-07 22:56:02eric.araujosetmessages: + msg212909
versions: + Python 3.3, Python 3.4, - 3rd party, Python 3.1, Python 3.2
2014-03-07 22:52:27eric.araujolinkissue19333 superseder
2014-03-07 22:50:08takluyversetnosy: + takluyver
messages: + msg212907
2010-11-06 12:12:51giampaolo.rodolasetmessages: + msg120611
2010-11-06 06:42:22eric.araujosetmessages: + msg120588
2010-09-30 01:49:58eric.araujosetversions: + 3rd party, Python 3.2, - Python 2.6, Python 3.0
messages: + msg117690

assignee: tarek -> eric.araujo
keywords: - needs review
type: behavior
stage: patch review
2010-05-16 18:12:32eric.araujosetnosy: + eric.araujo
2010-03-20 19:51:41tareksetnosy: loewis, jafo, amaury.forgeotdarc, giampaolo.rodola, tarek
messages: + msg101390
resolution: accepted
components: + Distutils2
2010-03-20 18:42:37jafosetpriority: normal
nosy: + jafo
messages: + msg101389

2009-02-06 01:28:03tareksetassignee: tarek
nosy: + tarek
2009-01-14 10:25:24amaury.forgeotdarcsetkeywords: + needs review, patch
nosy: + amaury.forgeotdarc
messages: + msg79845
files: + distutils_ioerror.patch
2009-01-13 18:57:52giampaolo.rodolasetmessages: + msg79769
2009-01-13 18:52:00loewissetnosy: + loewis
messages: + msg79767
2009-01-13 17:31:05giampaolo.rodolacreate