Python bindings for SUNDIALS
Project description
SundialsPy
SundialsPy is a Python interface to the SUNDIALS suite of ODE and DAE solvers, providing high-performance, flexible, and user-friendly access to advanced time integration algorithms for scientific computing and engineering applications.
Features
- Pythonic interface to SUNDIALS core solvers
- Support for both stiff and non-stiff ODEs
- Access to CVODE and ARKODE integrators
- Flexible right-hand side (RHS) and Jacobian callback support
- Vector and array tolerances
- Easy installation and usage
SundialsPy Installation Guide
Quick Installation (Recommended)
If binary wheels are available for your platform:
pip install SundialsPy
Installation from Source
If you need to build from source or binary wheels aren't available:
Prerequisites
Option 1: Using Conda (Recommended)
conda install -c conda-forge sundials pybind11 cmake numpy
pip install SundialsPy
Option 2: Using System Package Managers
macOS (Homebrew):
brew install sundials cmake
pip install pybind11[global] numpy
pip install SundialsPy
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install libsundials-dev cmake build-essential
pip install pybind11[global] numpy
pip install SundialsPy
Windows:
- Install Visual Studio Build Tools
- Install CMake
- Download and install SUNDIALS from here
- Set environment variables:
set SUNDIALS_ROOT=C:\path\to\sundials set SUNDIALS_INCLUDE_DIR=C:\path\to\sundials\include set SUNDIALS_LIBRARY_DIR=C:\path\to\sundials\lib
- Install SundialsPy:
pip install pybind11[global] numpy pip install SundialsPy
Manual SUNDIALS Installation
If SUNDIALS is not available through package managers:
# Download SUNDIALS
wget https://github.com/LLNL/sundials/releases/download/v6.6.2/sundials-6.6.2.tar.gz
tar -xzf sundials-6.6.2.tar.gz
cd sundials-6.6.2
# Build and install
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON
make -j$(nproc) # Linux/macOS
# make -j%NUMBER_OF_PROCESSORS% # Windows
sudo make install # Linux/macOS (or run as admin on Windows)
Then install SundialsPy:
pip install pybind11[global] numpy
pip install SundialsPy
Troubleshooting
Common Issues
-
"SUNDIALS not found" error:
- Make sure SUNDIALS is installed and in your PATH
- Set environment variables manually:
export SUNDIALS_ROOT=/path/to/sundials export SUNDIALS_INCLUDE_DIR=/path/to/sundials/include export SUNDIALS_LIBRARY_DIR=/path/to/sundials/lib
-
"pybind11 not found" error:
pip install "pybind11[global]"
-
Import errors:
- Make sure you're using the correct Python environment
- Try reinstalling:
pip uninstall SundialsPy && pip install SundialsPy
Supported Platforms
- ✅ Linux (x86_64)
- ✅ macOS (x86_64, arm64)
- ✅ Windows (x86_64)
- ✅ Python 3.8-3.12
Development Installation
For developers who want to modify the code:
git clone https://github.com/yourusername/SundialsPy.git
cd SundialsPy
# Install dependencies
conda install -c conda-forge sundials pybind11 cmake numpy
# Install in development mode
pip install -e .
Docker Installation
For a completely isolated environment:
FROM python:3.11-slim
RUN apt-get update && apt-get install -y \
libsundials-dev \
cmake \
build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN pip install SundialsPy
# Test the installation
RUN python -c "import SundialsPy; print('SundialsPy installed successfully!')"
Usage Example
import numpy as np
import SundialsPy
# Define a simple ODE: dy/dt = -0.5*y
def rhs(t, y):
return np.array([-0.5 * y[0]])
# Initial condition
y0 = np.array([1.0])
t0 = 0.0
t_end = 2.0
# Create a CVODE solver (BDF + Newton)
solver = SundialsPy.cvode.CVodeSolver(
system_size=1,
rhs_fn=rhs,
iter_type=SundialsPy.cvode.IterationType.NEWTON,
linsol_type=SundialsPy.cvode.LinearSolverType.DENSE,
use_bdf=True
)
solver.initialize(y0, t0, 1e-6, np.array([1e-8]))
result = solver.solve_to(0.1)
print("Solution at t=0.1:", result)
Available Integrators
CVODE
- BDF (Backward Differentiation Formula): For stiff ODEs
- Adams: For non-stiff ODEs
- Iteration Types: Newton, Functional
- Linear Solvers: Dense, Band, Sparse, Iterative (SPGMR, SPBCG, SPTFQMR, PCG)
ARKODE
- Explicit, Implicit, and IMEX Runge-Kutta methods
- Butcher tables for various schemes
Directory Structure
SundialsPy/— Python packagesrc/— C++ source code and pybind11 bindingsexamples/— Example scripts
Contributing
Contributions are welcome! Please open issues or pull requests for bug reports, feature requests, or improvements.
License
Acknowledgments
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sundialspy-0.1.0.tar.gz.
File metadata
- Download URL: sundialspy-0.1.0.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c8ad6c8931c1d9a5bc2da8d15078987af37f262d96f93b0f00951eaace8eace
|
|
| MD5 |
e4a4816e3a4ccaff3a76312d39a1b351
|
|
| BLAKE2b-256 |
97650919e3593b15f80dd8429729eb698002bdbd8ff48f3ab2cd0ec1cc8ef1e8
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0.tar.gz:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0.tar.gz -
Subject digest:
8c8ad6c8931c1d9a5bc2da8d15078987af37f262d96f93b0f00951eaace8eace - Sigstore transparency entry: 975843655
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c720944193497fd921f70b4cd544cf4e67bac222e02f46367ec5bfef0c571079
|
|
| MD5 |
084ebc0994a3b6c96d233d802da3acbc
|
|
| BLAKE2b-256 |
81b11d20c2ea5d48646fe31619467a8f788af5bb1b61a3580c3769596a8dbfb0
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
c720944193497fd921f70b4cd544cf4e67bac222e02f46367ec5bfef0c571079 - Sigstore transparency entry: 975843662
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp312-cp312-macosx_14_0_arm64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72250aa6d537ca8ff79c345fc5273ef17f1207069ee6b0d8d7c7c1431dcdc244
|
|
| MD5 |
9722a8698550a296d05a6aa6795c8fd9
|
|
| BLAKE2b-256 |
5035c236f9d402d9cca571accd7163de2187923556423a85772895b2ac9b8e55
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp312-cp312-macosx_14_0_arm64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp312-cp312-macosx_14_0_arm64.whl -
Subject digest:
72250aa6d537ca8ff79c345fc5273ef17f1207069ee6b0d8d7c7c1431dcdc244 - Sigstore transparency entry: 975843659
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8749d4c3ca7034dc5a360b5c0c818faf28b816dc7970ea92b67a25d008e95200
|
|
| MD5 |
eaba8d372ea509a69953e3fc3ce5198d
|
|
| BLAKE2b-256 |
cb561edf55311e3f120e16aebc9e5b2436e9a37ec25de59ae1b473055b2a564c
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
8749d4c3ca7034dc5a360b5c0c818faf28b816dc7970ea92b67a25d008e95200 - Sigstore transparency entry: 975843663
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp311-cp311-macosx_14_0_arm64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9540440f2e7281c0424fd10dad0d6a342f29e4227b4e56f70fb14cece0200d1
|
|
| MD5 |
7dcabd29fbc84af729c5fd04b120bd34
|
|
| BLAKE2b-256 |
4939db6c76818eb4d03b80e348741ddb72255c5b90899678af415c98a0021f07
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp311-cp311-macosx_14_0_arm64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp311-cp311-macosx_14_0_arm64.whl -
Subject digest:
c9540440f2e7281c0424fd10dad0d6a342f29e4227b4e56f70fb14cece0200d1 - Sigstore transparency entry: 975843667
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61e0ece45c56ce02c3413ffaf37142d963b31525b0d3e8824e9ab23c114caccd
|
|
| MD5 |
5d8e4a8a79542cb79c12f9723b249fca
|
|
| BLAKE2b-256 |
ac9e3b1bbc08c988969e6c0a2c493c4a1ff9bfa1627f0b094df580270eb0cdb0
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
61e0ece45c56ce02c3413ffaf37142d963b31525b0d3e8824e9ab23c114caccd - Sigstore transparency entry: 975843664
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp310-cp310-macosx_14_0_arm64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa1fd249917e80f9cac1b4e26d8b2254ad3b642f107856b13ddf7d9f9edefd09
|
|
| MD5 |
e1e860338f47eab5d34c84a02307f617
|
|
| BLAKE2b-256 |
140b575ddb0c67826bbb987349b9f577c216fb64a9d7a550211e84257f09bfb7
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp310-cp310-macosx_14_0_arm64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp310-cp310-macosx_14_0_arm64.whl -
Subject digest:
fa1fd249917e80f9cac1b4e26d8b2254ad3b642f107856b13ddf7d9f9edefd09 - Sigstore transparency entry: 975843666
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1445f78208c64de9163e5565ec5d840d9b96bfa975f0c4b4d74e4c6708a9741
|
|
| MD5 |
f27a2891e1f7275aac4f4fd579c5413d
|
|
| BLAKE2b-256 |
746999c8eb3f941e2c56de7cdef0640aa49cd3f30b3d682662c1437963fdfc05
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
f1445f78208c64de9163e5565ec5d840d9b96bfa975f0c4b4d74e4c6708a9741 - Sigstore transparency entry: 975843657
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sundialspy-0.1.0-cp39-cp39-macosx_14_0_arm64.whl.
File metadata
- Download URL: sundialspy-0.1.0-cp39-cp39-macosx_14_0_arm64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b93aff5f8d9f3b41d0f971d1b8537f5604493aacfe30cd827a6a083a94a679d
|
|
| MD5 |
de6f6a8fc17b1eb945245d17ae5870c6
|
|
| BLAKE2b-256 |
c449db6cc5a3614d93f25397273a062e9df17fd3677aee71dd9952685cd841f1
|
Provenance
The following attestation bundles were made for sundialspy-0.1.0-cp39-cp39-macosx_14_0_arm64.whl:
Publisher:
publish.yml on elotech47/pysundials
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sundialspy-0.1.0-cp39-cp39-macosx_14_0_arm64.whl -
Subject digest:
8b93aff5f8d9f3b41d0f971d1b8537f5604493aacfe30cd827a6a083a94a679d - Sigstore transparency entry: 975843665
- Sigstore integration time:
-
Permalink:
elotech47/pysundials@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/elotech47
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@136cb28d1a84f5399f08f319749bdc698a8b3656 -
Trigger Event:
push
-
Statement type: