odes icon indicating copy to clipboard operation
odes copied to clipboard

Issue using scikits.odes with Python 3.5 and 3.7 but not with 3.6

Open fcooper8472 opened this issue 6 years ago • 3 comments

We're using scikits.odes in a battery modelling project PyBaMM. We've run into the following difficulty getting it working as expected with our continuous integration: everything works fine with Python 3.6, but not with Python 3.5 and 3.7.

Example failure on 3.5 Example success on 3.6 Example failure on 3.7

In each of the failures the errors are reported as

ValueError: Integrator name <ida or cvode> does not exsist

With these specific failures I have tried using your Sundials installation scripts, and can't see any obvious reason that there would be any difference between python versions.

Have you seen this before? Any ideas what the problem might be? Thanks for your help!

fcooper8472 avatar Feb 25 '19 12:02 fcooper8472

I don't fully follow the bug. @aragilar is the resident build expert. Our Travis build succeeds I see. I did a PR now, it is rebuilding, but I assume all will be fine. Integrator name not found means the sundials libs are not found on loading odes, so they cannot be used.

bmcage avatar Mar 06 '19 08:03 bmcage

I looked at the logs, the important part is:

Could not load IDA solver numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
ImportError: No module named 'numpy.core._multiarray_umath'
numpy.core.multiarray failed to import
ImportError: No module named 'numpy.core._multiarray_umath'
numpy.core.multiarray failed to import

So somehow there's a issue with numpy, which is affecting the cython code. Either numpy didn't build/link properly, or there are multiple versions of numpy involved. I'm guessing that scikits.odes was built against a different version of numpy to that imported in the unit tests.

aragilar avatar Mar 07 '19 00:03 aragilar

Many thanks for looking into this @bmcage and @aragilar.

The problem does seem to be that there are several version of numpy involved. Looking at the output from this failure (Python 3.5), installing our software requires (arbitrarily) numpy>=1.14 and this is already satisfied in the travis environment:

Requirement already satisfied: numpy>=1.14 in /home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages (from pybamm==0.0.0) (1.15.4)

Later, through, we pip install -v scikits.odes, and that acquires a different version of numpy:

Installing build dependencies ...   Running command /home/travis/virtualenv/python3.5.6/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-qp3k4ksz --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel numpy cython

which ends up with Using version 1.16.1.

So the issue seems to be that installing scikits.odes ignores the already-installed numpy and pulls in the latest one available. Any idea why? (Probably something to do with the --ignore-installed?)

fcooper8472 avatar Mar 07 '19 11:03 fcooper8472