Issue 4931: distutils does not show any error msg when can't build C module extensions due to a missing C compiler (original) (raw)

Created on 2009-01-13 17:31 by giampaolo.rodola, last changed 2022-04-11 14:56 by admin. 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: ", 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 for a report from setuptools with an easy to reuse test case.
msg213207 - (view) Author: Roundup Robot (python-dev) (Python triager) 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) (Python triager) 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) (Python triager) 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
2022-04-11 14:56:44 admin set github: 49181
2014-03-12 08:25:30 eric.araujo set status: open -> closedresolution: accepted -> fixedmessages: + stage: patch review -> resolved
2014-03-12 08:11:09 python-dev set messages: +
2014-03-12 07:19:45 python-dev set messages: +
2014-03-12 07:15:04 python-dev set nosy: + python-devmessages: +
2014-03-07 22:56:02 eric.araujo set messages: + versions: + Python 3.3, Python 3.4, - 3rd party, Python 3.1, Python 3.2
2014-03-07 22:52:27 eric.araujo link issue19333 superseder
2014-03-07 22:50:08 takluyver set nosy: + takluyvermessages: +
2010-11-06 12:12:51 giampaolo.rodola set messages: +
2010-11-06 06:42:22 eric.araujo set messages: +
2010-09-30 01:49:58 eric.araujo set versions: + 3rd party, Python 3.2, - Python 2.6, Python 3.0messages: + assignee: tarek -> eric.araujokeywords: - needs reviewtype: behaviorstage: patch review
2010-05-16 18:12:32 eric.araujo set nosy: + eric.araujo
2010-03-20 19:51:41 tarek set nosy:loewis, jafo, amaury.forgeotdarc, giampaolo.rodola, tarekmessages: + resolution: acceptedcomponents: + Distutils2
2010-03-20 18:42:37 jafo set priority: normalnosy: + jafomessages: +
2009-02-06 01:28:03 tarek set assignee: tareknosy: + tarek
2009-01-14 10:25:24 amaury.forgeotdarc set keywords: + needs review, patchnosy: + amaury.forgeotdarcmessages: + files: + distutils_ioerror.patch
2009-01-13 18:57:52 giampaolo.rodola set messages: +
2009-01-13 18:52:00 loewis set nosy: + loewismessages: +
2009-01-13 17:31:05 giampaolo.rodola create