Ask Your Question
0

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

asked 2012-05-17 05:20:02 -0500

juanpool gravatar image

updated 2012-05-17 05:20:33 -0500

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-05-18 11:27:22 -0500

Mike Hansen gravatar image

Try running

$ sage -sh

from the command-line first. When you then run,

$ f2py -m -c rw2 rw2.f90

it will pick up Sage's copy of f2py (which will use Sage's Python).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-05-17 05:20:02 -0500

Seen: 239 times

Last updated: May 18 '12