pythonfortranvisual-studio-2019f2pyintel-parallel-studio

radial.o : error LNK2001: unresolved external symbol lambda_fatal error LNK1120: 8 unresolved externals,error.failed with exit status 1120


I am running an open-source package that has some codes in Python 3.7 mixed with Fortran FOR . I use Visual Studio 2019 and Intel Parallel Studio 2019 integrated.so when I run in Intel CMD f2py -c radial.for I got this error :

radial.o : error LNK2001: unresolved external symbol lambda_
fatal error LNK1120: 8 unresolved externals
error: Command...failed with exit status 1120

So what should I do.I tested that I have problem with Fortran Codes.Any help would be appreciated.

my Intel CMD:

There were some command maybe make it working wrong,but now I don't have any idea.

...
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "untitled" sources
f2py options: []
f2py:> C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitledmodule.c
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7
Reading fortran codes...
        Reading file 'radial.for' (format:fix,strict)
Post-processing...
        Block: untitled
{'attrspec': ['intent(in)']}
In: :untitled:radial.for:rad_fun
vars2fortran: No typespec for argument "kob".
{'attrspec': ['intent(in)']}
In: :untitled:radial.for:rad_fun
vars2fortran: No typespec for argument "m".
{'attrspec': ['intent(in)']}
In: :untitled:radial.for:rad_fun
vars2fortran: No typespec for argument "ne".
{'attrspec': ['intent(in)']}
In: :untitled:radial.for:rad_fun
vars2fortran: No typespec for argument "eps".
                        Block: rad_fun
Post-processing (stage 2)...
Building modules...
        Building module "untitled"...
                Constructing wrapper function "rad_fun"...
                  r1f,r1d,r2f,r2d = rad_fun(kob,m,ne,c2,ksi0,eps)
                Constructing COMMON block support for "k1"...
                  s,s1,aksi,ak,k,nk,nal
                Constructing COMMON block support for "eps1"...
                  eps1
                Constructing COMMON block support for "eps33"...
                  eps33
                Constructing COMMON block support for "eps3"...
                  eps3
                Constructing COMMON block support for "fact"...
                  fact
                Constructing COMMON block support for "pi"...
                  pi
        Wrote C/API module "untitled" to file "C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitledmodule.c"
        Fortran 77 wrappers are saved to "C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled-f2pywrappers.f"
  adding 'C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\fortranobject.c' to sources.
  adding 'C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7' to include_dirs.
copying C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\src\fortranobject.c -> C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7
copying C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\src\fortranobject.h -> C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7
  adding 'C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Found executable C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe
Could not locate executable C:\Program
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64VisualFCompiler
customize IntelEM64VisualFCompiler using build_ext
building 'untitled' extension
compiling C sources
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9
creating C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7
...


compiling Fortran sources
Fortran f77 compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
Fortran f90 compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
Fortran fix compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
compile options: '-IC:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7 -IC:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -IC:\Users\admin\AppData\Local\Programs\Python\Python37\include -IC:\Users\admin\AppData\Local\Programs\Python\Python37\include -c'
ifort.exe:f77: radial.for
ifort.exe:f77: C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled-f2pywrappers.f
ifort: commanifortd: command line warning #10161: unrecognized so line warning #10161: unrecognized source type 'Fileurce type 'Files's;'; obje object file assumed
ct file assumed
ifort: command line warning #10161: unrecognized source type '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windoifort: command line warning #10161: unrecognized source type '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windws\bows\bin\intel64\ifort.exe'; object file assumed
in\intel64\ifort.exe'; object file assumed
ifort: command line warning #10006: ignoriinfg unknown optiono r't/c : command line warning #10006: ignoring unknown opt'ion '/c '

ifort: warning #10145: no action performed for file 'Files'
ifort: warning #10145: no action performed for file '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'
ifort: warning #10145: no action performed for file 'Files'
ifort: warning #10145: no action performed for file '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\libs /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\PCbuild\amd64 /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\libs /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\PCbuild\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib\release /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mkl\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\daal\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\lib\intel64_win\vc_mt /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib\release /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mkl\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\daal\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\lib\intel64_win\vc_mt /EXPORT:PyInit_untitled C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitledmodule.obj C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\fortranobject.obj C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\radial.o C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled-f2pywrappers.o /OUT:.\untitled.cp37-win_amd64.pyd /IMPLIB:C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled.cp37-win_amd64.lib
   Creating library C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled.cp37-win_amd64.lib and object C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled.cp37-win_amd64.exp
radial.o : error LNK2001: unresolved external symbol lambda_
radial.o : error LNK2001: unresolved external symbol funlegnn_
radial.o : error LNK2001: unresolved external symbol cdcof4a_
radial.o : error LNK2001: unresolved external symbol cdrg1cn_
radial.o : error LNK2001: unresolved external symbol cdrsf212_
radial.o : error LNK2001: unresolved external symbol cdrf12cc_
radial.o : error LNK2001: unresolved external symbol cdrb12cc_
radial.o : error LNK2001: unresolved external symbol cdrsf20_
.\untitled.cp37-win_amd64.pyd : fatal error LNK1120: 8 unresolved externals
error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\libs /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\PCbuild\amd64 /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\libs /LIBPATH:C:\Users\admin\AppData\Local\Programs\Python\Python37\PCbuild\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib\release /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mkl\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\daal\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\lib\intel64_win\vc_mt /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\compiler\lib\intel64_win /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\lib\x64 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib\release /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mpi\intel64\bin\..\..\intel64\lib /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\mkl\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\bin\..\lib\intel64\vc14 /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\daal\lib\intel64_win /LIBPATH:C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\tbb\lib\intel64_win\vc_mt /EXPORT:PyInit_untitled C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitledmodule.obj C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\fortranobject.obj C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\radial.o C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled-f2pywrappers.o /OUT:.\untitled.cp37-win_amd64.pyd /IMPLIB:C:\Users\admin\AppData\Local\Temp\tmpe33yukr9\Release\Users\admin\AppData\Local\Temp\tmpe33yukr9\src.win-amd64-3.7\untitled.cp37-win_amd64.lib" failed with exit status 1120

radial.for:

c****************************************************************************
c                    Radial spheroidal functions
c
c parameters:
c    kob  - switch between prolate (0) and oblate (1) functions
c    m    - index m
c    ne   - maximum index n
c    c2   - argument c (complex*16)
c    ksi0 - argument xi (real*8)
c    eps  - accuracy of getting eigenvalues
c
c results (all complex*16):
c    R1f(ne) - functions R^(1)_mn (c,xi),  n = 1, ne
c    R1d(ne) - derivatives dR^(1)_mn (c,xi)/dxi, n = 1, ne
c    R2f(ne) - functions R^(2)_mn (c,xi),  n = 1, ne
c    R2d(ne) - derivatives dR^(2)_mn (c,xi)/dxi, n = 1, ne
c
c 2005, Nov
c****************************************************************************

      SUBROUTINE rad_fun (kob, m, ne, C2, KSI0, EPS, R1f, R1d, R2f,R2d)
      parameter (nterms=330)
      IMPLICIT REAL*8 (A-H,O-Q,T-Z), COMPLEX*16 (R-S)
      REAL*8 C2, ksi0
      complex*16 R1f , R1d , R2f , R2d 
      COMPLEX*16 bdc2
      DIMENSION RLC2(nterms), rDC2(4*nterms), bDC2(4*nterms)
      COMMON /K1/ S, S1, AKSI, AK, K, NK, nal
      COMMON /EPS1/ EPS1
      COMMON /EPS33/ EPS33
      COMMON /EPS3/ EPS3
      COMMON /FACT/ FACT(300)
      COMMON /PI/ PI
cf2py intent(in) kob, m, ne, C2, KSI0, EPS
cf2py intent(out) R1f, R1d, R2f, R2d
c      open(unit=07,file='sph_fun.out',status='unknown',access='append')

      NMAX = ne
      NMXE = nmax
      NK = NMAX+40
      IF (NK.LT.60) NK = 60
      IF (Ksi0.gt.1.5d0) NK = nk+40
c      NK=4*nterms
      IF (NK.GT.4*nterms) NK = 4*nterms

      k = kob
      IF(K) 5005,6,5005
 5005 CONTINUE
       AK=-1D0
       GO TO 7
    6 CONTINUE
       AK= 1D0
    7 CONTINUE
      x = ksi0
      IF(K.eq.0) AKSI=X**2-1D0
      IF(K.eq.1) AKSI=X**2+1D0

c      if (k.eq.0 .and. x.lt.1.00001d0) then
c      write (*,2114) x
c      write (7,2114) x
c      end if

c      if (k.eq.1 .and. x.lt.0.00001d0) then
c      write (*,2115) x
c      write (7,2115) x
c      end if
c 2114 FORMAT(1X,3('!'), '    Prolate x > 1  x = ',f5.3)
c 2115 FORMAT(1X,3('!'), '    Oblate x > 0   x = ',f5.3)

      S=(0D0,0D0)
      S1=(0D0,1D0)
      nal = 1
      EPS=1D-15
      EPS1=1D-12
*       eps3 = 1d-80
*       eps3 = 1d-100
       eps3 = 1d-200
       eps33 = eps3
      pi = 4d0 * datan(1d0)

c factorial
       FACT(1)=1D0
       FACT(2)=1D0
       DO 130 I=3,170
  130  FACT(I)=FACT(I-1)*(I-1D0)
       FACT(170)=FACT(170)*(1.D-300)
       DO J = 170, 297
        FACT(J+1)=J*FACT(J)
       end do

c-----------------

c  112 FORMAT(1X,61('.'))
c  202 FORMAT(1X,'homFUNq NN>nterms',5X,'NN=',I5)
c  210 FORMAT(1X,'L=',I4,5X,'IER1,2,3,4,5=',5I5)
c  212 FORMAT(1X,'I,L=',2I5,5X,'IER=',I5)

      W1=1D0/(C2*(ksi0**2-1D0+2*K))
      ncc = real(c2)
      IF (NE-nterms)  40,40,41
c   41   WRITE(7,202) NE
c        WRITE(*,202) NE
   41 RETURN
   40 CONTINUE
      RC1=c2

c calc of lambda

      call lambda(K,M,ne,C2,EPS,rlc2,ie)
      if(ie.ne.0) return

      inum1 = nk
      if(nk.lt.inum1) inum1=nk+10

      if(k.eq.0) then
        ifun1 = 44
        IF(ksi0.GE.1.5D0) IFUN1 = 22
      end if

      if(k.eq.1) then
        ifun1 = 33
        IF(ksi0.GE.1.5D0) IFUN1 = 22
      end if

c calc of Leg. functions

      CALL funlegnn (m, ksi0, inum1)

...

UPDATE1:

radial.for first lines edited:

MODULE my_module
IMPLICIT NONE 
CONTAINS
  INCLUDE 'lib.for' 
END MODULE 
…
 SUBROUTINE rad_fun (kob, m, ne, C2, KSI0, EPS, R1f, R1d, R2f,R2d)
      USE my_module
...

my Intel CMD: for command f2py -c radial.for

running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "untitled" sources
f2py options: []
f2py:> C:\Users\admin\AppData\Local\Temp\tmp62485e0j\src.win-amd64-3.7\untitledmodule.c
creating C:\Users\admin\AppData\Local\Temp\tmp62485e0j\src.win-amd64-3.7
Reading fortran codes...
        Reading file 'radial.for' (format:fix,strict)
Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\Scripts\f2py-script.py", line 11, in <module>
    load_entry_point('numpy==1.16.4', 'console_scripts', 'f2py')()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\f2py2e.py", line 683, in main
    run_compile()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\f2py2e.py", line 650, in run_compile
    setup(ext_modules=[ext])
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\core.py", line 171, in setup
    return old_setup(**new_attr)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\command\build.py", line 47, in run
    old_build.run(self)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\command\build_src.py", line 148, in run
    self.build_sources()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\command\build_src.py", line 165, in build_sources
    self.build_extension_sources(ext)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\command\build_src.py", line 325, in build_extension_sources
    sources = self.f2py_sources(sources, ext)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\distutils\command\build_src.py", line 562, in f2py_sources
    ['-m', ext_name]+f_sources)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\f2py2e.py", line 425, in run_main
    postlist = callcrackfortran(files, options)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\f2py2e.py", line 329, in callcrackfortran
    postlist = crackfortran.crackfortran(files)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\crackfortran.py", line 3251, in crackfortran
    readfortrancode(files, crackline)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\f2py\crackfortran.py", line 412, in readfortrancode
    'this code is in fix form?\n\tline=%s' % repr(l))
Exception: readfortrancode: Found non-(space,digit) char in the first column.
        Are you sure that this code is in fix form?
        line='MODULE my_module'

UPDATE #2 radial.for: so the error disappeared

After definition of subroutine

COMPLEX*16  bdc9

When I want to call function

bdc9=CMPLX(C2,0.0)
      call lambda(K,M,ne,bdc9,EPS,rlc2,ie)

Solution

  • radial.for first lines edited:

    MODULE my_module
    IMPLICIT NONE 
    CONTAINS
      INCLUDE 'lib.for' 
    END MODULE 
    …
     SUBROUTINE rad_fun (kob, m, ne, C2, KSI0, EPS, R1f, R1d, R2f,R2d)
          USE my_module
    ...
    

    command f2py -c radial.for

    radial.for: so the error disappeared

    After definition of subroutine

    COMPLEX*16  bdc9
    

    When I want to call function

    bdc9=CMPLX(C2,0.0)
          call lambda(K,M,ne,bdc9,EPS,rlc2,ie)