[Numpy-discussion] Still having issues with f2py
Blubaugh, David A.
dblubaugh at belcan.com
Wed Sep 10 20:33:31 EDT 2008
Mark,
THANK YOU GREATLY FOR YOUR HELP!!
I have executed all that suggestions that you have made:
I was able to have f2py be able to detect two distinct fortran compilers
on the computer that I am utilizing. However, I have found a new error
that I found to be somewhat unclear. The error is as follows:
I will try to input the following commands into an MS-DOS prompt:
C:\Python25\Scripts>c:\python25\python f2py.py -c fib1_proj.f90 -m
fib1_proj
You should know that I have the FORTRAN file located within the Scripts
directory along with the f2py.py file, which is also located in the
Scripts directory. The scripts directory is as follows:
C:\Python25\Scripts
Therefore, once this line was executed, it was then able to execute
python as well as f2py.py and be able to obtain fib1_proj.f90.
However, this is the error that I obtained:
running build
running scons
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.
I was wondering if the (.f90) extension was causing the problems?? I
was also wondering as to what is involved with "compiling with MingW32,
by passing "-c mingw32" to setup.py."??
Thank You All Greatly,
David Blubaugh
________________________________
From: Mark Miller [mailto:markperrymiller at gmail.com]
Sent: Tuesday, September 09, 2008 7:06 PM
To: Blubaugh, David A.
Subject: Re: Still having issues
Hi David: I'm not 100% sure of what's going on. I've used F2py many
times myself in the windows environment.
Once thing that struck me from your message is that you mentioned
running the command from within IDLE. Try opening up a command prompt
window (in the Accessories section within the START menu of Windows) and
issuing the commands from there. There is no need to import F2py
modules into the python shell itself.
If issuing things from the command line does not work, then I would
suggest the following:
1) remove Numpy
2) remove Python
3) re-install Python from the 'official' binary source (the simple
windows setup program)
4) re-install Numpy using the simple windows setup program
Once that is done, try the following two things(I assume that your
Python will be in c:\python25. If not, change the commands as
appropriate!):
First, make sure that you can run F2py. Just run the following to see
if you get any errors.
python c:\python25\scripts\f2py.py
If that works, issue the following command to see if f2py is picking up
your fortran compiler.
Python C:\python25\scripts\f2py.py -c --help-fcompiler
If the second one fails, you may need to make sure that you add your
fortran compiler's path to the Windows environment path variable.
Does that make sense?
-Mark
On Tue, Sep 9, 2008 at 3:53 PM, Blubaugh, David A.
<dblubaugh at belcan.com> wrote:
Mark,
I have taken the advice that you had given to me the other day.
However, I am still having issues with actually executing the
f2py.py
script.
> If numpy is installed, then f2py will be too. > On the
windows
environment,
> there is a file called f2py.py that you can >>> > call
from the
command line. It
> should be in the 'scripts' directory of your > > Python
installation.
>
> Try something like this:
>
> python c:\python25\scripts\f2py.py
> (of course change to reflect your own python > >
installation
directory)
It appears that once I run the f2py.py script from the IDLE
environment,
I will then obtain the following error:
You will have to read at the end of the listed output. It looks
as
though there was a premature system exit once f2py.py was
executed.
>>>
Usage:
1) To construct extension module sources:
f2py [<options>] <fortran files> [[[only:]||[skip:]] \
<fortran functions> ] \
[: <fortran files> ...]
2) To compile fortran files and build extension modules:
f2py -c [<options>, <build_flib options>, <extra options>]
<fortran files>
3) To generate signature files:
f2py -h <filename.pyf> ...< same options as in (1) >
Description: This program generates a Python C/API file
(<modulename>module.c)
that contains wrappers for given fortran functions
so that
they
can be called from Python. With the -c option the
corresponding
extension modules are built.
Options:
--g3-numpy Use numpy.f2py.lib tool, the 3rd generation of
F2PY,
with NumPy support.
--2d-numpy Use numpy.f2py tool with NumPy support.
[DEFAULT]
--2d-numeric Use f2py2e tool with Numeric support.
--2d-numarray Use f2py2e tool with Numarray support.
-h <filename> Write signatures of the fortran routines to
file
<filename>
and exit. You can then edit <filename> and use
it
instead
of <fortran files>. If <filename>==stdout then
the
signatures are printed to stdout.
<fortran functions> Names of fortran routines for which Python
C/API
functions will be generated. Default is all
that are
found
in <fortran files>.
<fortran files> Paths to fortran/signature files that will be
scanned
for
<fortran functions> in order to determine
their
signatures.
skip: Ignore fortran functions that follow until
`:'.
only: Use only fortran functions that follow until
`:'.
: Get back to <fortran files> mode.
-m <modulename> Name of the module; f2py generates a Python/C
API
file <modulename>module.c or extension module
<modulename>.
Default is 'untitled'.
--[no-]lower Do [not] lower the cases in <fortran files>.
By
default,
--lower is assumed with -h key, and --no-lower
without -h key.
--build-dir <dirname> All f2py generated files are created in
<dirname>.
Default is tempfile.mktemp().
--overwrite-signature Overwrite existing signature file.
--[no-]latex-doc Create (or not) <modulename>module.tex.
Default is --no-latex-doc.
--short-latex Create 'incomplete' LaTeX document (without
commands
\documentclass, \tableofcontents, and
\begin{document},
\end{document}).
--[no-]rest-doc Create (or not) <modulename>module.rst.
Default is --no-rest-doc.
--debug-capi Create C/API code that reports the state of
the
wrappers
during runtime. Useful for debugging.
--[no-]wrap-functions Create Fortran subroutine wrappers to
Fortran
77
functions. --wrap-functions is default because
it
ensures
maximum portability/compiler independence.
--include_paths <path1>:<path2>:... Search include files from
the
given
directories.
--help-link [..] List system resources found by system_info.py.
See
also
--link-<resource> switch below. [..] is
optional list
of resources names. E.g. try 'f2py --help-link
lapack_opt'.
--quiet Run quietly.
--verbose Run with extra verbosity.
-v Print f2py version ID and exit.
numpy.distutils options (only effective with -c):
--fcompiler= Specify Fortran compiler type by vendor
--compiler= Specify C compiler type (as defined by
distutils)
--help-fcompiler List available Fortran compilers and exit
--f77exec= Specify the path to F77 compiler
--f90exec= Specify the path to F90 compiler
--f77flags= Specify F77 compiler flags
--f90flags= Specify F90 compiler flags
--opt= Specify optimization flags
--arch= Specify architecture specific optimization
flags
--noopt Compile without optimization
--noarch Compile without arch-dependent
optimization
--debug Compile with debugging information
Extra options (only effective with -c):
--link-<resource> Link extension module with <resource> as
defined
by numpy.distutils/system_info.py. E.g. to
link
with optimized LAPACK libraries (vecLib on
MacOSX,
ATLAS elsewhere), use --link-lapack_opt.
See also --help-link switch.
-L/path/to/lib/ -l<libname>
-D<define> -U<name>
-I/path/to/include/
<filename>.o <filename>.so <filename>.a
Using the following macros may be required with non-gcc Fortran
compilers:
-DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN
-DUNDERSCORE_G77
When using -DF2PY_REPORT_ATEXIT, a performance report of F2PY
interface is printed out at exit (platforms: Linux).
When using -DF2PY_REPORT_ON_ARRAY_COPY=<int>, a message is
sent to stderr whenever F2PY interface makes a copy of an
array. Integer <int> sets the threshold for array sizes when
a message should be shown.
Version: 2_4423
numpy Version: 1.0.4
Requires: Python 2.3 or higher.
License: NumPy license (see LICENSE.txt in the NumPy source
code)
Copyright 1999 - 2005 Pearu Peterson all rights reserved.
http://cens.ioc.ee/projects/f2py2e/
Traceback (most recent call last):
File "C:\Python25\Scripts\f2py.py", line 26, in <module>
main()
File "C:\Python25\lib\site-packages\numpy\f2py\f2py2e.py", line
560,
in main
run_main(sys.argv[1:])
File "C:\Python25\lib\site-packages\numpy\f2py\f2py2e.py", line
339,
in run_main
files,options=scaninputline(comline_list)
File "C:\Python25\lib\site-packages\numpy\f2py\f2py2e.py", line
241,
in scaninputline
sys.exit()
SystemExit
Mark,
I appears that the system has prematurely exited from execution.
Any
solutions???
David
This e-mail transmission contains information that is
confidential and may be
privileged. It is intended only for the addressee(s) named
above. If you receive
this e-mail in error, please do not read, copy or disseminate it
in any manner.
If you are not the intended recipient, any disclosure, copying,
distribution or
use of the contents of this information is prohibited. Please
reply to the
message immediately by informing the sender that the message was
misdirected.
After replying, please erase it from your computer system. Your
assistance in
correcting this error is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080910/b9ab1d39/attachment.html>
More information about the NumPy-Discussion
mailing list