[SciPy-user] Performance Python examples

David Powell davidanthonypowell@gmail....
Sun Jun 28 21:41:49 CDT 2009


>
> ---------- Forwarded message ----------
> From: Robert Kern <robert.kern@gmail.com>
> To: SciPy Users List <scipy-user@scipy.org>
> Date: Thu, 25 Jun 2009 20:35:11 -0500
> Subject: Re: [SciPy-user] Performance Python examples
> On Thu, Jun 25, 2009 at 20:06, David Powell<davidanthonypowell@gmail.com>
> wrote:
> > Hi all,
> >
> > I was looking at the code on the PerformancePython wiki page and I had
> > a few questions/comments:
> >
> > Firstly, the f2py based example code does not build under windows.
> > For me it gives an error and asks me to use the -c mingw option, and
> > even if I do run setup.py with this option it still doesn't work.  Has
> > anyone else had this problem?
>
> Please, always copy-and-paste error messages instead of paraphrasing
> them, or worse, just saying that it doesn't work. What FORTRAN
> compiler are you using?
>

Firstly I get the following error:

'f2py' is not recognized as an internal or external command,
operable program or batch file.
C:\Python25\lib\site-packages\numpy\lib\utils.py:108: DeprecationWarning:
('get_numpy_include is deprecated, use get_include',)
  warnings.warn(str1, DeprecationWarning)
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.

However I can easily overcome this by adding f2py.bat to C:\Python25\Scripts
to call f2py.py.  Upon doing this, I then get the following error message


running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
options
running build_src
building extension "flaplace" sources
f2py options: []
f2py:>
c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5\flaplacemodule.c
creating c:\docume~1\dap124\locals~1\temp\tmpl4dqj7
creating c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5
Reading fortran codes...
        Reading file 'src/flaplace.f' (format:fix,strict)
Post-processing...
        Block: flaplace
                        Block: timestep
Post-processing (stage 2)...
Building modules...
        Building module "flaplace"...
                Constructing wrapper function "timestep"...
                  u,error = timestep(u,dx,dy)
        Wrote C/API module "flaplace" to file
"c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5/flaplacemodule.c"
  adding
'c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5\fortranobject.c'
to sources.
  adding 'c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5' to
include_dirs.
copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.c ->
c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5
copying C:\Python25\lib\site-packages\numpy\f2py\src\fortranobject.h ->
c:\docume~1\dap124\locals~1\temp\tmpl4dqj7\src.win32-2.5
running build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
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.
C:\Python25\lib\site-packages\numpy\lib\utils.py:108: DeprecationWarning:
('get_numpy_include is deprecated, use get_include',)
  warnings.warn(str1, DeprecationWarning)
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.
C:\Documents and Settings\dap124\My Documents\code\perfpy>python setup.py
build_ext --inplace
'f2py' is not recognized as an internal or external command,
operable program or batch file.
C:\Python25\lib\site-packages\numpy\lib\utils.py:108: DeprecationWarning:
('get_numpy_include is deprecated, use get_include',)
  warnings.warn(str1, DeprecationWarning)
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.

This happens even if I manually add -c mingw32 to the call to f2py in
setup.py.

My g77 --version gives:

GNU Fortran (GCC) 3.4.5 (mingw-vista special r3)

Anyway, I am not overly concerned about this for my own use because I'm not
really planning on using f2py - I just thought there could be a problem with
this example which is worth reporting as it prevents others from running it.

PS: I had a try at writing something at numexpr, but what I came up with was
slower than just using numpy arrays.  So I'd probably stick to use
weave.inline.  However I just realised that to get the full benefit of using
openmp needs gcc 4.x, but I am not sure which version of mingw numpy and
scipy are built with and whether this will cause compatibility problems.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090629/ec15b32c/attachment.html 


More information about the SciPy-user mailing list