WISDEM / pyHAMS

Apache License 2.0
11 stars 7 forks source link

Seeking a way to install for development #12

Open mattEhall opened 10 months ago

mattEhall commented 10 months ago

Would @gbarter or anyone have advice for how to install the latest version of PyHAMS in develop mode (on Windows)?

After updating my PyHAMS folder from a very old version, I wasn't able to install from the folder. Python install.py doesn't existing anymore and pip install can't find dependencies (meson build log pasted below). So far the installation method that's worked for me is "conda install -c conda-forge pyhams", but that's not from a local directory I can then edit.

I don't need to do anything with the compiled HAMS code. I just want to be able to work on the the pyhams.py functions. Any tips much appreciated. Matt

Meson setup.py log from when I try "pip install -e .":

The Meson build system
Version: 1.2.3
Source dir: C:\Code\pyHAMS
Build dir: C:\Code\pyHAMS\meson_build
Build type: native build
Project name: pyhams
Project version: undefined
C compiler for the host machine: gcc (gcc 5.3.0 "gcc (Rev5, Built by MSYS2 project) 5.3.0")
C linker for the host machine: gcc ld.bfd 2.25.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Fortran compiler for the host machine: gfortran (gcc 5.3.0 "GNU Fortran (Rev5, Built by MSYS2 project) 5.3.0")
Fortran linker for the host machine: gfortran ld.bfd 2.25.1
Library m found: YES
Compiler for Fortran supports arguments -fdec-math: NO 
Compiler for Fortran supports arguments -fno-align-commons: YES 
Run-time dependency OpenMP found: YES 4.0
Found pkg-config: C:\Users\mhall\Anaconda3\envs\raft\Library\mingw-w64\bin\pkg-config.EXE (0.29.1)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency mkl_rt found: NO (tried pkgconfig and cmake)
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
Run-time dependency blas found: NO (tried pkgconfig and cmake)
Run-time dependency lapack found: NO (tried pkgconfig)

meson.build:57:9: ERROR: Dependency "lapack" not found, tried pkgconfig

A full log can be found at C:\Code\pyHAMS\meson_build\meson-logs\meson-log.txt
gbarter commented 10 months ago

Hi Matt,

PyHAMS is successfully built and tested on Windows on the Github CI. Be sure you have all of the packages listed in the environment file installed locally. From your error message, I think you need to install the openblas package.

Cheers, Garrett

mattEhall commented 10 months ago

Thanks Garrett, that makes sense. Unfortunately the Meson build system doesn't seem to see what I install. I tried installing OpenBLAS and also LAPACK (with "conda install -c anaconda openblas" and "conda install -c conda-forge lapack"). They show up in the list of installed packages, but they don't seem to get seen by the Meson build process still...

      Run-time dependency mkl_rt found: NO (tried pkgconfig and cmake)
      Run-time dependency openblas found: NO (tried pkgconfig and cmake)
      Run-time dependency blas found: NO (tried pkgconfig and cmake)
      Run-time dependency lapack found: NO (tried pkgconfig)

      meson.build:57:9: ERROR: Dependency "lapack" not found, tried pkgconfig

I also found a description about installing OpenBLAS here: https://github.com/OpenMathLib/OpenBLAS/wiki/Installation-Guide#windows but this seems a bit involved and I'm guessing it's not what's intended.

gbarter commented 10 months ago

Hmm, if you installed openblas but it cannot be found, can you double check that the following are all installed too: conda install m2w64-toolchain libpython pkg-config cmake?

mattEhall commented 10 months ago

After I entered that command, it looks like cmake and some dependencies were installed. Now Meson sees cmake, but it's still not finding openblas or lapack:

      Found pkg-config: C:\Users\mhall\Anaconda3\envs\raft\Library\mingw-w64\bin\pkg-config.EXE (0.29.1)
      Found CMake: C:\Users\mhall\Anaconda3\envs\raft\Library\bin\cmake.EXE (3.27.6)
      Run-time dependency mkl_rt found: NO (tried pkgconfig and cmake)
      Run-time dependency openblas found: NO (tried pkgconfig and cmake)
      Run-time dependency blas found: NO (tried pkgconfig and cmake)
      Run-time dependency lapack found: NO (tried pkgconfig and cmake)

lapack, libblas, liblapabk, libopenblas, and openblas all show up when I do "conda list". I wonder if there's something I can do to help cmake or pkgconfig find things?

gbarter commented 8 months ago

Coming back to this, I have revamped the build system and understand things a bit better. The mingw pkg-config does not work and blocks the regular conda pkg-config from finding all of those libraries. You have to manually remove it (you can see the path in your above message).

pyHAMS now works and builds in conda for all platforms. The next stage will be to remove the old windows mingw compiler dependency and use something more current. That will be for another day though.