CyRK

raw JSON →
0.17.1 verified Fri May 01 auth: no python

CyRK is a Python package providing fast Runge-Kutta ODE integrators implemented in Cython and Numba. Version 0.17.1 supports Python 3.9–3.14 and offers drop-in replacements for scipy.integrate.solve_ivp with improved performance via C++ backends and optional numba acceleration. It has a moderate release cadence, roughly monthly.

pip install cyrk
error ModuleNotFoundError: No module named 'cyrk'
cause Incorrect import casing: the package is installed as 'cyrk' but the Python module is 'CyRK'.
fix
Use from CyRK import cysolve_ivp or import CyRK.
error ValueError: Unknown solver method 'RK45'. Supported methods: ...
cause Passing an invalid method name to cysolve_ivp. CyRK supports a limited set of methods.
fix
Use one of the supported methods: 'RK23', 'RK45', 'DOP853', 'RKF45', 'RKCK45'. Check CyRK documentation for full list.
error TypeError: 'NoneType' object is not callable
cause Using the reuse functionality without properly resetting the result object between runs.
fix
Call result.setup_for_reuse() before reusing, or simply create a new result object.
gotcha Package import is case-sensitive: import CyRK not cyrk. Wrong casing raises ImportError.
fix Use from CyRK import ...
gotcha CyRK uses its own solver classes and does not accept scipy OdeSolvers as input. Passing a scipy solver object will fail.
fix Use only methods like 'RK45', 'RK23', 'DOP853' (strings) supported by CyRK.
breaking In v0.15.0, std::optional was removed from integrator configs. Code relying on accessing optional fields directly may break.
fix Update to v0.15+; if you used optional fields, access them as regular attributes now.

Basic usage of cysolve_ivp to solve a simple ODE. Note the case-sensitive import.

import numpy as np
from CyRK import cysolve_ivp

def diffeq(t, y):
    return np.array([-0.5 * y[0]])

t_span = (0.0, 10.0)
y0 = np.array([1.0])
result = cysolve_ivp(diffeq, t_span, y0, method='RK45', rtol=1e-6, atol=1e-8)
print(result.success, result.t[-1], result.y[0, -1])