CSHS-CWRA / RavenPy

A Python wrapper to setup and run the hydrologic modelling framework Raven
https://ravenpy.readthedocs.io
MIT License
25 stars 5 forks source link

Can't "pip install ravenpy[gis]" on ARM-based Mac architectures #370

Closed julemai closed 2 weeks ago

julemai commented 1 month ago

Description

I try to pip install RavenPy[gis] and it does throw error messages. I am guessing because there is and issue with compiling the Raven code, i.e.,

      /private/var/folders/mc/ks_z5qjs1bq7m6kgtlx1_v940000gn/T/pip-install-ygjkwybk/raven-hydro_b3e722675cf448a4a4531ae189487ef1/RavenHydroFramework/src/SubBasin.cpp:1784:25: error: use of undeclared identifier 'finite'; did you mean 'isfinite'?
            ExitGracefullyIf(!_finite(_aUnitHydro[n]),
                              ^
      /private/var/folders/mc/ks_z5qjs1bq7m6kgtlx1_v940000gn/T/pip-install-ygjkwybk/raven-hydro_b3e722675cf448a4a4531ae189487ef1/RavenHydroFramework/src/RavenInclude.h:1468:20: note: expanded from macro '_finite'
      #define _finite(v) finite(v)
                         ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/math.h:403:80: note: 'isfinite' declared here
      _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT {
                                                                                     ^
      1 warning and 1 error generated.

The full output is attached.

compile_msg.txt

Zeitsperre commented 1 month ago

Hey Julie,

Are you using a new architecture Mac? The issue has to do with the newer standards for clang and is a problem with RavenHydroFramework. James just released released a new version that should let us add a few more build architectures (I'm out of the office at the moment, but will be doing that when I get back), but apparently the problem requires a bit more effort for the ARM-based Macs. He's aware of the problem.

julemai commented 1 month ago

Hi!

Yes, I had reported this to James a while back. The only line of code that needs to be adjusted to compile Raven on the new architecture is the one I mentioned above. Nothing else I had to adjust.

I was wondering if there is any possibility to get a pip install of ravenPy where it does not compile Raven at all but rather the user can specify the path of an existing Raven executable they might have? Just an idea.

Enjoy your vacation. There is no rush on my end to get this done. I still have an old Mac that I am using in the meanwhile.

Cheers, Julie

Zeitsperre commented 1 month ago

I was wondering if there is any possibility to get a pip install of ravenPy where it does not compile Raven at all but rather the user can specify the path of an existing Raven executable they might have? Just an idea.

As of right now, I don't believe it's possible. This package needs raven-hydro to run. We would need to change things either in this project or at that level to allow users to override this. I'll open another issue to track that problem.

julemai commented 1 month ago

If the user provides an executable, I'd hope it also runs. 😄 But that's probably not what you mean.

huard commented 1 month ago

One subtlety is that by controlling the build, we're able to create a shared library that let's us interact directly with the RavenC library. It's very superficial for now, but I'm hoping we can use this strategy and the BMI interface to reduce IO and improve performance in the future.