How to install scikits.odes on Python 3.X

826 views Asked by At

I'm trying out other ODE solvers besides SciPy's odeint. I found a possible one, scikits.odes package. The requirements include C and FORTRAN compiler (I downloaded MinGW-w64, no problems), LAPACK (downloaded, build, tested, seems fine), and SUNDIALS (problems with LAPACK). If LAPACK is not enabled in SUNDIALS then installing and running scikits.odes.test() will have several errors. Anybody that could help me with this issue.

After installing scikits.odes on Python 3.5.5 and running:

import scikits.odes as od
od.test()

I have the following output:

Running unit tests for scikits.odes
NumPy version 1.15.1
NumPy relaxed strides checking option: True
NumPy is installed in C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\numpy
Python version 3.5.5 |Anaconda, Inc.| (default, Apr  7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)]
nose version 1.3.7
Ecannot import name 'cvode'
.EEEEEE.EE.EEEE
======================================================================
ERROR: Failure: ImportError (No module named 'scikits.odes.sundials.common_defs')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_dae.py", line 15, in <module>
    from scikits.odes.sundials.common_defs import DTYPE
ImportError: No module named 'scikits.odes.sundials.common_defs'

======================================================================
ERROR: test_get_info_is_exposed_on_ode (scikits.odes.tests.test_get_info.GetInfoTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_get_info.py", line 23, in setUp
    self.ode = ode('cvode', rhs, old_api=False)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: test_get_info_returns_dict (scikits.odes.tests.test_get_info.GetInfoTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_get_info.py", line 23, in setUp
    self.ode = ode('cvode', rhs, old_api=False)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: test_ode_exposes_num_rhs_evals (scikits.odes.tests.test_get_info.GetInfoTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_get_info.py", line 23, in setUp
    self.ode = ode('cvode', rhs, old_api=False)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: test_we_integrated_correctly (scikits.odes.tests.test_get_info.GetInfoTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_get_info.py", line 23, in setUp
    self.ode = ode('cvode', rhs, old_api=False)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: test_ode_exposes_num_njtimes_evals (scikits.odes.tests.test_get_info.GetInfoTestSpils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_get_info.py", line 50, in setUp
    self.ode = ode('cvode', rhs, linsolver="spgmr", old_api=False)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: test_odeint (scikits.odes.tests.test_odeint.TestOdeint)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_odeint.py", line 47, in test_odeint
    self._do_problem(problem)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_odeint.py", line 33, in _do_problem
    sol = odeint(problem.f, t, problem.z0, method=method)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\odeint.py", line 215, in odeint
    solver = ode(int_name, rhsfun, **options)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: scikits.odes.tests.test_odeint.test_odeint_banded_jacobian
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_odeint.py", line 292, in test_odeint_banded_jacobian
    jacfn=jac)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\odeint.py", line 215, in odeint
    solver = ode(int_name, rhsfun, **options)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: scikits.odes.tests.test_odeint.test_odeint_errors
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_odeint.py", line 403, in test_odeint_errors
    assert_raises(ZeroDivisionError, odeint, bad1, [0, 1], [1.0])
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\numpy\testing\_private\utils.py", line 1244, in assert_raises
    return _d.assertRaises(*args,**kwargs)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\unittest\case.py", line 733, in assertRaises
    return context.handle('assertRaises', args, kwargs)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\unittest\case.py", line 178, in handle
    callable_obj(*args, **kwargs)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\odeint.py", line 215, in odeint
    solver = ode(int_name, rhsfun, **options)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 273, in __init__
    integrator = find_ode_integrator(integrator_name)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\ode.py", line 486, in find_ode_integrator
    raise ValueError('Integrator name %s does not exist' % name)
ValueError: Integrator name cvode does not exist

======================================================================
ERROR: Failure: ImportError (No module named 'scikits.odes.sundials.cvode')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_on_funcs.py", line 16, in <module>
    from scikits.odes.sundials.cvode import StatusEnum
ImportError: No module named 'scikits.odes.sundials.cvode'

======================================================================
ERROR: Failure: ImportError (No module named 'scikits.odes.sundials.ida')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_on_funcs_ida.py", line 16, in <module>
    from scikits.odes.sundials.ida import StatusEnumIDA
ImportError: No module named 'scikits.odes.sundials.ida'

======================================================================
ERROR: Failure: ImportError (No module named 'scikits.odes.sundials.cvode')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_user_return_vals_cvode.py", line 5, in <module>
    from ..sundials.cvode import StatusEnum
ImportError: No module named 'scikits.odes.sundials.cvode'

======================================================================
ERROR: Failure: ImportError (No module named 'scikits.odes.sundials.ida')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\loader.py", line 417, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\nose\importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 697, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\Users\f_lon_000\Anaconda3\envs\Python_35\lib\site-packages\scikits\odes\tests\test_user_return_vals_ida.py", line 5, in <module>
    from ..sundials.ida import StatusEnumIDA
ImportError: No module named 'scikits.odes.sundials.ida'

----------------------------------------------------------------------
Ran 16 tests in 0.422s

FAILED (errors=13)
Out[2]: <nose.result.TextTestResult run=16 errors=13 failures=0>

According to the troubleshooting procedure for scikits.odes found in https://scikits-odes.readthedocs.io/en/latest/installation.html#troubleshooting this is caused by SUNDIALS not being linked to LAPACK.

I followed the procedure described in https://icl.cs.utk.edu/lapack-for-windows/lapack/#build for an easy windows LAPACK build with MinGW-w64. When I run:

C:/Program_Files/mingw-w64/x86_64-8.1.0-posix-sjlj-rt_v6-rev0/mingw64/bin/mingw32-make.exe test

on the command prompt to test the LAPACK build it works fine (all tests are passed).

To install SUNDIALS 2.7.0 I follow a similar procedure. With CMake I choose the source folder, I select a different build folder, use configure and select LAPACK_ENABLE. When I configure again I receive the error below.

CMake Error:

The Fortran compiler identification is GNU 8.1.0

Searching for a Fortran compiler... C:/Program_Files/mingw-w64/x86_64-8.1.0-posix-sjlj-rt_v6-rev0/mingw64/bin/x86_64-w64-mingw32-gfortran.exe

Trying to compile and link a simple Fortran program... OK

Determining Fortran name-mangling scheme... OK

Looking for LAPACK libraries... OK

Checking if Lapack works... FAILED

WARNING: LAPACK not functional.

   Blas/Lapack support will not be provided.

Added NVECTOR_SERIAL module

Added ARKODE module

Added CVODE module

Added CVODES module

Added IDA module

Added IDAS module

Added KINSOL module

Configuring done

By the way, kind of new to programming, I'm trying all this on Windows 10, Python 3.5.5, LAPACK 3.8.0, SUNDIALS 2.7.0, CMake 3.11.4.

0

There are 0 answers