[Numpy-discussion] Compiling NumPy on Windows for Python 3.3
Ralf Gommers
ralf.gommers at gmail.com
Sun Nov 11 16:05:32 EST 2012
On Sun, Nov 11, 2012 at 12:43 AM, Peter Cock <p.j.a.cock at googlemail.com>wrote:
> On Sat, Nov 10, 2012 at 11:24 PM, Peter Cock <p.j.a.cock at googlemail.com>
> wrote:
> >
> > I think part of the problem could be in numpy/distutils/misc_util.py
> > where there is no code to detect MSCV 10,
> >
> > def msvc_runtime_library():
> > "Return name of MSVC runtime library if Python was built with MSVC
> >= 7"
> > msc_pos = sys.version.find('MSC v.')
> > if msc_pos != -1:
> > msc_ver = sys.version[msc_pos+6:msc_pos+10]
> > lib = {'1300' : 'msvcr70', # MSVC 7.0
> > '1310' : 'msvcr71', # MSVC 7.1
> > '1400' : 'msvcr80', # MSVC 8
> > '1500' : 'msvcr90', # MSVC 9 (VS 2008)
> > }.get(msc_ver, None)
> > else:
> > lib = None
> > return lib
> >
> >
> https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py#L353
> >
> > Under Python 3.3, we have:
> >
> > Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600
> > 32 bit (Intel)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> import sys
> >>>> sys.version
> > '3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit
> (Intel)]'
> >
> > i.e. It looks to me like that dictionary needs another entry for key
> '1600'.
> >
>
> Adding this line seems to help,
>
> '1600' : 'msvcr100', # MSVC 10 (aka 2010)
>
> Now my compile gets further, but runs into another issue:
>
> File "c:\python33\lib\distutils\command\config.py", line 246, in try_link
> libraries, library_dirs, lang)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\command\config.py",
> line 146, in _link
> generate_manifest(self)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\mingw32ccompiler.py",
> line 562, in generate_manifest
> check_embedded_msvcr_match_linked(msver)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\mingw32ccompiler.py",
> line 541, in check_embedded_msvcr_match_linked
> "(%d)" % (int(msver), maj))
> ValueError: Discrepancy between linked msvcr (10) and the one about to
> be embedded (1)
>
> My hunch was version something about the new three digit version
> number is breaking things... which appears to be breaking here:
>
> def check_embedded_msvcr_match_linked(msver):
> """msver is the ms runtime version used for the MANIFEST."""
> # check msvcr major version are the same for linking and
> # embedding
> msvcv = msvc_runtime_library()
> if msvcv:
> maj = int(msvcv[5:6])
> if not maj == int(msver):
> raise ValueError(
> "Discrepancy between linked msvcr " \
> "(%d) and the one about to be embedded " \
> "(%d)" % (int(msver), maj))
>
>
> https://github.com/numpy/numpy/blob/master/numpy/distutils/mingw32ccompiler.py#L530
>
> As you can see, to get the major version number from the
> string it looks at the first digit. When the string was something
> like "81" or "90" that was fine, but now it is "100". Instead it
> should look at all the digits up to the final one, i.e. use:
>
> maj = int(msvcv[5:-1])
>
> Now (finally), I get an understandable (but hopefully wrong)
> error message from trying to build NumPy 1.7.0b2 under
> Python 3.3 on Windows XP,
>
> File "numpy\core\setup.py", line 646, in get_mathlib_info
> st = config_cmd.try_link('int main(void) { return 0;}')
> File "c:\python33\lib\distutils\command\config.py", line 246, in try_link
> libraries, library_dirs, lang)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\command\config.py",
> line 146, in _link
> generate_manifest(self)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\mingw32ccompiler.py",
> line 568, in generate_manifest
> manxml = msvc_manifest_xml(ma, mi)
> File
> "C:\Downloads\numpy-1.7.0b2\build\py3k\numpy\distutils\mingw32ccompiler.py",
> line 484, in msvc_manifest_xml
> % (maj, min))
> ValueError: Version 10,0 of MSVCRT not supported yet
>
> Presumably those two changes I have described are worth
> committing to the trunk anyway? I can prepare a patch or
> pull request, but currently I've been working on this Windows
> box remotely and I'd prefer to wait until next week when I
> can do it directly on the machine concerned.
>
Those changes look correct, a PR would be great.
Fixing the next error also seems straightforward; around line 465 of
mingw32ccompiler a check is needed for 10.0 (not sure which one) and then a
line like
_MSVCRVER_TO_FULLVER['10'] = "10.0.xxxxx.x"
needs to be added.
Ralf
> Files affected:
> numpy/distutils/misc_util.py function msvc_runtime_library
> numpy/distutils/mingw32ccompiler.py function
> check_embedded_msvcr_match_linked
>
> Peter
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20121111/50ec94bf/attachment.html>
More information about the NumPy-Discussion
mailing list