djlampert / PyHSPF

Python extensions to the Hydrological Simulation Program in Fortran (HSPF), including classes for gathering input data, building input files, performing simulations, postprocessing results, calibrating hydrology process parameters, and forecasting climate and land use change effects on water resources
Other
83 stars 51 forks source link

building pyhspf on windows 7 #5

Closed AtrCheema closed 6 years ago

AtrCheema commented 6 years ago

I am trying to recompile pyhspf but I am getting some error which I am not understanding. I have gcc and gfortran available as environment variables. I get following error message

C:\Users\USER1312\Downloads\PyHSPF-master\PyHSPF-master\src>gfortran
gfortran: fatal error: no input files
compilation terminated.

C:\Users\USER1312\Downloads\PyHSPF-master\PyHSPF-master\src>gcc
gcc: fatal error: no input files
compilation terminated.

C:\Users\USER1312\Downloads\PyHSPF-master\PyHSPF-master\src>C:\Users\USER1312\
aconda3\envs\py27\python setup.py config --compiler=mingw32 build --compiler=m
gw32 >> compilemsg.txt
error: Command "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\m
gw64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -O0 -Ibuild
rc.win-amd64-2.7 -IC:\Users\USER1312\Anaconda3\envs\py27\lib\site-packages\num
\core\include -IC:\Users\USER1312\Anaconda3\envs\py27\include -IC:\Users\USER1
2\Anaconda3\envs\py27\PC -c -c hspf13/djl.f -o build\temp.win-amd64-2.7\Releas
hspf13\djl.o -O3 -fno-automatic -fno-align-commons" failed with exit status 1

I am attaching the 'compilemsg.txt' file which contains the detailed output from above command. compilemsg.txt

djlampert commented 6 years ago

Is this Python 2 or 3? PyHSPF will only use Python 3. The messages seem to indicate that it is using Python 2.7 I think.

AtrCheema commented 6 years ago

This is with Python 2.7. However when I tried with python 3, I get the following error

` Looking for python36.dll

Traceback (most recent call last):

File "setup.py", line 192, in (module)

    extra_f77_compile_args=fflags

File "C:\Users\atr\Anaconda3\lib\site-packages\numpy\distutils\core.py", line 166, in setup

    return old_setup(**new_attr)

File "C:\Users\atr\Anaconda3\lib\distutils\core.py", line 148, in setup

    dist.run_commands()

File "C:\Users\atr\Anaconda3\lib\distutils\dist.py", line 955, in run_commands

    self.run_command(cmd)

File "C:\Users\atr\Anaconda3\lib\distutils\core.py", line 974, in run_command
    cmd_obj.run()

File "C:\Users\atr\Anaconda3\lib\site-packages\numpy\distutils\command\build.py", line 47, in run

    old_build.run(self)

File "C:\Users\atr\Anaconda3\lib\distutils\command\build.py", line 135, in run

    self.run_command(cmd_name)

File "C:\Users\atr\Anaconda3\lib\distutils\cmd.py", line 313 in run_command

    self.distribution.run_command(command)

File "C:\Users\atr\Anaconda3\lib\distutils\dist.py", line 974, in run_command

    cmd_obj.run()

File "C:\Users\atr\Anaconda3\lib\site_packages\numpy\distutils\command\build_ext.py", line 117, in run

force=self.force)

File "C:\Users\atr\Anaconda3\lib\site-packages\numpy\distutils\ccompiler.py", line 596, in new_compiler

    compiler = klass(None, dry_run, force)

File "C:\Users\atr\Anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 96, in __init__

msvcr_success = build_msvcr_library()

File "C:\Users\atr\Anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 329, in build_msvc_library

if int(msvc_name.lstrip('msvcr')) < 80:

AttributeError: 'NoneType' object has no attribute 'lsrip'

`

I looked into msvc_runtime_library() found that following result can be useful

` sys.version.find('MSC v.')

66

` I have Microsoft Visual C++ 2015, 2013,2012, 2010,2008, 2005 installed in my machine.

djlampert commented 6 years ago

I tried to compile the code using Anaconda and was able to replicate this error. However, I have no trouble compiling using CPython. I believe you can use wheels and installers built with CPython in Anaconda. Anaconda looks like CPython, but it is a completely different environment. We had trouble in the past with WDM files in Anaconda-derived PyHSPF codes. We don't really have control over issues resulting from Anaconda, so I will close this out.

AtrCheema commented 6 years ago

Thank you for your response. I installed Python by downloading exe file from python.org and tried to compile PyHSPF. This time I encountered with following error

`

C:\Users\USER1312\Downloads\201808이전 다운로드파일\PyHSPF-master\PyHSPF- 
master\src>C:\Python37\python setup.py config --compiler=mingw32 build --compiler=mingw32 >> 
compilemsg.txt
error: Command "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6- 
rev0\mingw64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -O3 -funroll-loops - 
Ibuild\src.win-amd64-3.7\build\src.win-am
d64-3.7 -IC:\Python37\lib\site-packages\numpy\core\include -IC:\Python37\include - 
IC:\Python37\include -c -c hspf13/djl.f -o build\temp.win-amd64-3.7\Release\hspf13\djl.o -O3 -fno- 
automatic -fno-align-commons
" failed with exit status 1

` My numpy version is 1.14.5. I googled -fno-align-commons error and thought it might be because of different versions of gcc and gfortran but both versions of gcc and gfortran are same i.e. 8.1.0.

The compilemsg.txt file can be found here.