Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to use sage's f2py from linux command line?

I usually run python scripts using SAGE via the command,

sage -python program.py

Now I want to use f2py to use a FORTRAN subroutine in my program. In my Linux version (Ubuntu 12.04) I have installed f2py (version 2), but that version does not use SAGE's Python as I can see from the following. I have a FORTRAN code in rw2.f90 and I run in a linux console,

$f2py -m -c rw2 rw2.f90

and it throws the following message,

error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/tmpyFNYE_/src.linux-x86_64-2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.c -o /tmp/tmpyFNYE_/tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.o" failed with exit status 1

From the message, it is clear that f2py is trying to use the version of Python that comes with my ubuntu. But I want that f2py use the SAGE's Python. How I do that?

Best regards

how to use sage's f2py from linux command line?

I usually run python scripts using SAGE via the command,

sage -python program.py

Now I want to use f2py to use a FORTRAN subroutine in my program. In my Linux version (Ubuntu 12.04) I have installed f2py (version 2), but that version does not use SAGE's Python as I can see from the following. I have a FORTRAN code in rw2.f90 and I run in a linux console,

$f2py -m -c rw2 rw2.f90

and it throws the following message,

error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/tmpyFNYE_/src.linux-x86_64-2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.c -o /tmp/tmpyFNYE_/tmp/tmpyFNYE_/src.linux-x86_64-2.7/fortranobject.o" failed with exit status 1

From the message, it is clear that f2py is trying to use the version of Python that comes with my ubuntu. But I want that f2py to use the SAGE's Python. How I do that?

Best regards