Questions tagged [f2py]

F2PY is a tool that provides an interface between the Python and Fortran programming languages.

F2PY is a tool that provides an interface between the and programming languages. F2PY is part of .

491 questions
0
votes
1 answer

Installing f2py in ubuntu

I wonder if anyone could help me with one issue: I am using ubuntu 12.04 and I wanted to install f2py. However the version found here: https://sysbio.ioc.ee/projects/f2py2e/index.html#installation Gives me an error with python 2.7.6. This issue…
Delosari
  • 677
  • 2
  • 17
  • 29
0
votes
1 answer

How to obtain how much time is spent in f2py wrappers

I am currently writing a time consuming python program and decided to rewrite part of the program in fortran. However, the performance is still not good. For profiling purpose, I want to know how much time is spent in f2py wrappers and how much time…
atbug
  • 818
  • 6
  • 26
0
votes
1 answer

Why is my f2py programs slower than python programs

I recently wrote a time consuming program with python and decided to rewrite the most time consuming part with fortran. However, the fortran code, wrapped with f2py, is slower than python code, Can anyone tell me how to find what is happening…
atbug
  • 818
  • 6
  • 26
0
votes
1 answer

f2py triggers malloc error

I am currently wrapping fortran code with f2py. However, even some simple tests will trigger malloc error. For example: ! file name is simple.F90 SUBROUTINE test(aout, ain, rank) INTEGER :: rank COMPLEX(kind=16) :: ain(rank, rank) …
atbug
  • 818
  • 6
  • 26
0
votes
1 answer

Problem using f2py

I have some routines written in fortran that I'd like to use in my python code. A quick websearch informed me about f2py, and I gave it a try. Using f2py -c numericalMethods.f -m numericalMethods it seems to work for a while until a lot of errors…
Nigu
  • 2,025
  • 2
  • 22
  • 31
0
votes
1 answer

Using internal allocatable arrays with f2py

I am using f2py to wrap some Fortran subroutines. When calling from Python, I always use explicit arrays for the input/output, but have a few working arrays that need to be allocatable. These arrays have no interface with Python. A small test…
trelau
  • 135
  • 1
  • 6
0
votes
1 answer

Segmentation faults using f2py

This is a follow up to a question I asked here... How do I allocate input arrays with f2py? I've reworked the question in response to comments. The original question was unclear and too lengthy. See comment 1 below. I am trying to use f2py to wrap…
ivanarnold
  • 115
  • 5
0
votes
2 answers

f2py: invalid type argument of unary ‘*’

I am trying to make a wrapper for a Fortran function with f2py from this code: http://arxiv.org/e-print/1601.07458v1 . It is from a paper concerning reduced density matrices, (http://arxiv.org/abs/1601.07458v1, and the code works fine when running…
Felix Huber
  • 133
  • 3
0
votes
1 answer

f2py with hello world

I am trying to learn how to compile fortran code in python using f2py. I am using Python 2.7.10 (via Python (x,y)) and Mingw32 as my compiler. I am trying to get this to work in 64-bit Windows 7, but the Python 2.7.10 is running in 32-bit. I added…
grover
  • 927
  • 1
  • 10
  • 21
0
votes
1 answer

How to use f2py to call a big fortran package

I need to use a math package which is entirely written in Fortran. The package is not in a single file but is compiled into an archive file (.a file). I have the full source code. I don't know Fortran. I did a quick read on f2py document here:…
wh0
  • 510
  • 1
  • 6
  • 19
0
votes
1 answer

Fortran or C and f2py to solve differential equations

This is more of a design question. I am involved with a project that requires us to solve a bunch of first order differential equations. I know the python has modules to this and we have been using those functions. However, we need the integrator…
AD0AE
  • 91
  • 5
0
votes
1 answer

f2py with Windows 7 (64-bit)

I am trying to compile a simple fortran hello world program to be called in python using f2py. I am using Python 2.7, Python(X,Y), Spyder, Mingw64, and Windows 7-64 bit. This is the fortran code I am trying to compile: C File hello.f subroutine…
grover
  • 927
  • 1
  • 10
  • 21
0
votes
0 answers

Using f2py with subroutines that depend of each other

I am trying to compile a whole fortran pack for python with f2py. The pack is this one. The problem is that most of the subroutines depend on other subroutines and etc and I can't compile successfully. I wrote a bash script that loops through all…
TomCho
  • 3,204
  • 6
  • 32
  • 83
0
votes
0 answers

Errors using f2py

I'm pretty new to Python (~4 months) and I'm trying to use some Fortran subroutines in python but I'm having major problems using f2py. I have looked through the documentation but can't make heads or tails of why I'm getting the errors that I'm…
Taylor
  • 378
  • 2
  • 4
  • 14
0
votes
1 answer

Importing a f2py .pyd from an explicit path (Bad magic number ImportError)

I have built a .pyd module from some fortran code via f2py, which we can call foo.pyd. I want to import this into a python code, which we can call main.py. When I import as: import foo everything works fine. However, because this python will…
brettb
  • 771
  • 1
  • 6
  • 14