EOA-team / PyProSAIL

GNU Lesser General Public License v3.0
9 stars 2 forks source link

Fatal Error: Cannot open module file 'mod_angle.mod' for reading at (1): No such file or directory [Windows] #4

Open burggraaff opened 12 months ago

burggraaff commented 12 months ago

Hi, I'm trying to install the module and I just can't get it to work.

I'm using pip 23.3.1 with Python 3.11.6, running in administrator mode on Windows 11 Pro. I'm using gfortran through mingw-w64 as a compiler.

I get an error upon trying to install, both when doing pip install pyprosail and when cloning this repository and running pip install . The console output fills up very quickly with tab warnings (-Wtab) but it appears that gfortran is happily compiling everything, until the very end:

      INFO: gfortran.exe:f90: ./pyprosail/PRO4SAIL.f90
      f951.exe: Warning: Nonexistent include directory 'build\temp.win-amd64-cpython-311\Release\' [-Wmissing-include-dirs]
      f951.exe: Warning: Nonexistent include directory 'build\temp.win-amd64-cpython-311\Release\' [-Wmissing-include-dirs]

         31 |         USE MOD_ANGLE
            |             1
      Fatal Error: Cannot open module file 'mod_angle.mod' for reading at (1): No such file or directory
      compilation terminated.
      error: Command "C:\Users\olieb\mingw64\bin\gfortran.exe -Wall -g -fno-second-underscore -O3 -funroll-loops -Ibuild\src.win-amd64-3.11\build\src.win-amd64-3.11 -IC:\Program Files\Python311\Lib\site-packages\numpy\core\include -Ibuild\src.win-amd64-3.11\numpy\distutils\include -IC:\Program Files\Python311\include -IC:\Program Files\Python311\Include -c -c ./pyprosail/PRO4SAIL.f90 -o build\temp.win-amd64-cpython-311\Release\pyprosail\PRO4SAIL.o -Jbuild\temp.win-amd64-cpython-311\Release\ -Ibuild\temp.win-amd64-cpython-311\Release\" failed with exit status 1
      INFO:
      ########### EXT COMPILER OPTIMIZATION ###########
      INFO: Platform      :
        Architecture: x64
        Compiler    : msvc

      CPU baseline  :
        Requested   : 'min'
        Enabled     : SSE SSE2 SSE3
        Flags       : none
        Extra checks: none

      CPU dispatch  :
        Requested   : 'max -xop -fma4'
        Enabled     : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
        Generated   : none
      INFO: CCompilerOpt.cache_flush[864] : write cache to path -> C:\Users\olieb\AppData\Local\Temp\pip-install-1r_lbnv7\pyprosail_a12479d74278474eb851bd7a375ca060\build\temp.win-amd64-cpython-311\Release\ccompiler_opt_cache_ext.py
      [end of output]

(I've removed the tab warnings from this)

For reference, when I download PROSAIL 5B from the official website and run the included _compil.bat file, it immediately compiles without any errors. This leads me to believe the issue is specific to PyProSAIL.

I have tried first using gfortran to compile the files in the ./pyprosail folder myself before installing through pip install . - this did not resolve the issue. I tried this by going through each file individually, using the batch file included with the main PROSAIL installation, using the Fortran files from this repo or the ones from the included RAR archive - nothing works. I'm not very familiar with how Python-Fortran extensions/libraries work so I didn't know anything else to try myself.

The issue appears to be Windows-specific, because I was able to install it on my Ubuntu laptop without any trouble (through pip install pyprosail).

lukasValentin commented 12 months ago

Hi @burggraaff,

hmm, this looks to me like a linking problem. To be honest, we are pure Linux users so we usually do not test for Windows since we even have no access to Windows machines for development... I also did an installation test on Ubuntu 22.04 and Fedora 38 so I can reaffirm that the Linux installation works just fine.

To me it seems there are two options:

  1. Try to avoid running PyProSAIL under Windows directly - would the Windows subsystem for Linux be a possibility for you? Back in time when I still had to use Win machines from time to time, the WSL often helped to resolve this kind of OS issues.
  2. Have a look into the setup.py and try to figure out if there are any build options that are required to compile the source code under Windows.

Personally, I'd recommended/ favor to use option 1 if there is no way around Windows.