Skip to content

Installation problem

I am currently trying to install your mcd-python interface, but I am having trouble with the F2PY features. I have successfully

  • Compiled NETCDF with the -fPIC options as described in your netcdf/gfortran_netcdf4_fPIC file (I have tried downloading the NETCDF C and Fortran libraries, but compiling MCD seems to work better when the C libraries are used).
  • Compiled MCD (version 5.2) with the fPIC NETCDF library
  • Updated my bashrc profile via the appropriate PYTHONPATH
  • Verified that compile_fmcd.sh links to the NETCDF libs and MCD directories.
  • Checked that f2py is installed. I have run with both PY2.7 and PY3.6, but I always get an error here.

During the command f2py -h fmcd$num.pyf -m fmcd$num tmp.call_mcd.F tmp.julian.F tmp.heights.F > fmcd$num.log 2>&1 (for me line 57 of compile_fmcd.sh) I get an error:

analyzeline: Failed to evaluate '.true.'. Ignoring: invalid syntax (<string>, line 1)
Reading fortran codes...
                Reading file 'tmp.call_mcd.F' (format:fix,strict)
                Reading file 'constants_mcd.inc' (format:fix)
Line #14 in constants_mcd.inc:"      parameter (output_messages=.true.)"
                determineexprtype: could not determine expressions ('.true.') type.
Traceback (most recent call last):
  File "/Users/aaronberliner/anaconda3/bin/f2py", line 28, in <module>
    main()
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 650, in main
    run_main(sys.argv[1:])
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 408, in run_main
    postlist = callcrackfortran(files, options)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 329, in callcrackfortran
    postlist = crackfortran.crackfortran(files)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/crackfortran.py", line 3246, in crackfortran
    readfortrancode(files, crackline)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/crackfortran.py", line 495, in readfortrancode
    readfortrancode(fn, dowithline=dowithline, istop=0)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/crackfortran.py", line 421, 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='n '

The error in this line seems to prevent downstream operations and the log will eventually read

Traceback (most recent call last):
  File "/Users/aaronberliner/anaconda3/bin/f2py", line 28, in <module>
    main()
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 648, in main
    run_compile()
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/f2py/f2py2e.py", line 622, in run_compile
    ext = Extension(**ext_args)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/site-packages/numpy/distutils/extension.py", line 54, in __init__
    export_symbols=export_symbols)
  File "/Users/aaronberliner/anaconda3/lib/python3.6/distutils/extension.py", line 104, in __init__
    raise AssertionError("'name' must be a string")
AssertionError: 'name' must be a string

As there doesn't seem to be a fmcd.pyf file created.