bmcage / odes

The ODES scikit for ordinary differential and algebraic equations, an extension to scipy
https://scikits-odes.readthedocs.io/
Other
122 stars 44 forks source link

Cannot compile `scikit.odes` from `master` because of non-existent include `cvode/cvode_direct.h` #178

Open dmitry-kabanov opened 1 month ago

dmitry-kabanov commented 1 month ago

Hi,

I try to compile scikit.odes from the latest master branch (on 2024-07-12) by going to the packages/scikit_odes_sundials subdirectory and executing pip install -e ..

Unfortunately, it does not compile with the following fatal error:

     src/scikits_odes_sundials/cvode.c:822:10: fatal error: cvode/cvode_direct.h: No such file or directory
        822 | #include "cvode/cvode_direct.h"
            |          ^~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.

I have Sundials 7.1.1 (current latest) installed, and I do not see this file there, so I think it should not be included then, at least for this version. The list of includes for cvode is here: https://github.com/LLNL/sundials/tree/main/include/cvode

aragilar commented 1 month ago

I guess that's one of the breaking changes between Sundials 6 and 7. I want to get everything in a working state on v6 first, then 6->7 should only be some minor changes to the sundials wrappers.

florian98765 commented 1 month ago

i was facing similar issues. after playing around with the sundials version i could install using pip install scikits-ode. i am now using sundials-6.7.0.

it would be very helpful to have a short INSTALL.txt which states which version of sundials the current code is working with. Or even some kind of install script which helps with the installation of a proper sundials version.

By the way, are there any plans to include your wrappers directly into the Sundials suite? I stumble over this topic every few years and it would be really cool to have some stable wrappers.

Thanks for all your work and best wishes!

c-randall commented 1 month ago

One idea, rather than listing the compatible sundials versions in a txt file, is to start building the scikits-odes-sundials package as wheels files with the sundials libraries bundled into the "whl" files. A lot of other packages that rely on compiled code (numpy, scipy, etc.) do this for ease of installation.

I've been working on packages that heavily rely on scikits-odes-sundials, so this is something that I've already been looking into lately. I will update if and when I get something working in case the developers would like to change their CI/CD to start uploading these pre-build wheels files to pypi instead of just the tarbell. The advantages and disadvantages for moving to this distribution method are outlined below.

Advantages:

1) Users wouldn't need to separately install sundials and/or a compiler prior to install scikits-odes-sundials. 2) Users would not need to worry about sundials version compatibility because a working version is always included.

Disadvantages.:

1) Wheels need to be built using GitHub actions or another CI server for each supported python version, operating system, and architecture. 2) Users would no longer have as much control over using a specific version of sundials. However, they could always build from source if they'd like to, instead of pulling the wheels from pypi. 3) The developers would be responsible for rebuilding the wheels if they wanted to update the version of sundials that is bundled in the wheels files.

florinerombach commented 3 weeks ago

Hi, I'm trying to install scikits-odes on linux using nix and the install fails - could it possibly be related to this issue?

I ran (in a nix-user-chroot shell):

nix-shell -p python311Packages.scikits-odes -p python311Packages.numpy --run 'python3'

And I get the error:

`Error compiling Cython file:

            err_handler = tmpfun

        self.aux_data.err_handler = err_handler

        flag = CVodeSetErrHandlerFn(
            cv_mem, _cv_err_handler_fn, <void*> self.aux_data)
                    ^

scikits/odes/sundials/cvode.pyx:1360:24: Cannot assign type 'void (int, const char , const char , char , void ) except ' to 'CVErrHandlerFn' (alias of 'void ()(int, char , char , char , void ) noexcept'). Exception values are incompatible. Suggest adding 'noexcept' to the type of '_cv_err_handler_fn'. ... Cython.Compiler.Errors.CompileError: scikits/odes/sundials/cvode.pyx error: builder for '/nix/store/cw31b1ranqnfrxw84c8vb731hj60gr9n-python3.11-scikits.odes-2.7.0.drv' failed with exit code 1`