0
votes

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.

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] 
Have you checked for tab characters in your Fortran source? You should have none. - francescalus
If you're getting some error messages or warnings, you need to put them here. - Random Davis
Tabs are not part of the Fortran character set. - francescalus
@francescalus I fixed the tabs. Thanks for pointing that out. I still have the other error message though. - Jeff Faraci
@RandomDavis I added the error message explicitly I obtain from the terminal, thanks. I also already stated this error message in the original post. Please read it. - Jeff Faraci