I am trying to use F2py but am getting some error messages or warnings on compilation involving `deprecated numpy'. I'm unsure how to fix this. I'm using python 2.7.17 and fortran90.
I compile by writing
f2py -c f2py_F90.f90 -m fortran
Note, compiling with :
f2py -c f2py_F90.f90 -m fortran \
doesn't fix the problem either.
Below are the basic fortran and python codes that indicate the problem I'm having. This example is minimal, complete and verifiable. How can I fix this problem and succesfully have python execute the fortran module I'm passing into it?
The message I get is
warning "Using deprecated NumPy API"
The expected output should give a = [2,1,3] but instead I get the warning described above.
!fortran code
module fmodule
implicit none
contains
subroutine fast_reverse(a,n)
integer, intent(in) :: n
real, intent(inout) :: a(:)
a(1:n) = a(n:1:-1)
end subroutine fast_reverse
end module fmodule
#python code
import fortran
import numpy as np
a = np.array([1,2,3],np.float32)
fortran.fmodule.fast_reverse(a,2)
a #the output should give a = [2,1,3]
getting some error messages or warnings, you need to put them here.python -m numpy.f2py -c fmodule.f90 -m fortranso that you know that the same python interpreter is used for both commands. Diagnosis:which -a pythonandwhich -a f2py. Also, any reason for using Python 2?f2pydemo (which I verified worked on my machine), it feels like you have a setup issue. If the installation is not done on your end, could you try running the demo in a virtual machine? Once you have a setup you know can work, it will make your debugging of your code much easier.