[SciPy-user] weave and compiler install help

Michael ODonnell odonnems at yahoo.com
Mon Dec 3 16:30:54 EST 2007


This may help give someone greater insight into my problem. If I run the command created by python:

cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC /Tpc:\temp\Michael\python24_compiled\sc_552cccf5dbf4f6eadd273cdcbd5860521.cpp /Foc:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\temp\Michael\python24_compiled\sc_552cccf5dbf4f6eadd273cdcbd5860521.obj /Zm1000

at the cmd prompt I get the following error:
c:\Python24\include\pyconfig.h(30) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory

This command was generated by weave.inline, but I copied it into the cmd window.

Does anyone have any ideas what I should/can do?

Thank you,
michael


----- Original Message ----
From: Fernando Perez <fperez.net at gmail.com>
To: SciPy Users List <scipy-user at scipy.org>
Sent: Sunday, December 2, 2007 11:09:32 PM
Subject: Re: [SciPy-user] weave and compiler install help


On Nov 19, 2007 9:06 AM, Michael ODonnell <odonnems at yahoo.com> wrote:
>
> I am trying to compile some inline c++ code inside python using
 weave. I
> always get a similar problem where the compiled file cannot be found
 (see
> below). I am not sure if the problem is with the compiler or
 something else.
> I am a new user of scipy and a novice with python so I would
 appreciate any
> direction someone can give me because I have not been able to figure
 out a
> work around.

> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> When I try to test the following script or any other script I get the
> following message:
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> def prod(m, v):
>     #C++ version
>     nrows, ncolumns = m.shape
>
>     res = numpy.zeros((nrows, ncolumns), float)
>     code = r"""
>     for (int i=0; i<nrows; i++)
>     {
>         for (int j=0; j<ncolumns; j++)
>         {
>             res(i) += m(i,j)*v(j);
>         }
>     }
>     """
>
>     #err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'],
> type_converters=converters.blitz, compiler='mingw32', verbose=2)
>     err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'],
> verbose=2)

There may be windows-specific problems (I'm on linux), but your code
as above simply can't work because you're assuming blitz behavior
(parens on m(i,j) calls) with the blitz call commented out.

On Linux, this version:

##########################################################
import numpy
from scipy import  weave
from scipy.weave import converters


def prod(m, v):
    #C++ version
    nrows, ncolumns = m.shape
    assert v.ndim==1 and ncolumns==v.shape[0],"Shape mismatch in prod"

    res = numpy.zeros(nrows, float)
    code = r"""
    for (int i=0; i<nrows; i++)
    {
        for (int j=0; j<ncolumns; j++)
        {
            res(i) += m(i,j)*v(j);
        }
    }
    """
    err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'],
 verbose=2,
    type_converters=converters.blitz)
    return res

m=numpy.random.rand(3,4)
v = numpy.random.rand(4)
mv = prod(m,v)
mvd = numpy.dot(m,v)
print 'Err:',numpy.linalg.norm(mv-mvd)
#######  EOF  ###############################################

produces errors within floating-point tolerances, as expected:

In [41]: run weaveex.py
Err: 1.11022302463e-16

In [42]: run weaveex.py
Err: 5.55111512313e-17

In [43]: run weaveex.py
Err: 2.77555756156e-17


As I said in my other message, it's still worth filing a ticket on
this with the exact input/output pair that produced the error.  If
it's a core weave bug we'll find it in any platform, and even if it's
platform specific it will ensure that it doesn't get lost in the mists
of mailing lists.

Cheers,

f
_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user






      ____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20071203/af2ed32a/attachment.html>


More information about the SciPy-User mailing list