skillfed

casadi

CasADi -- framework for algorithmic differentiation and numeric optimization

casadi v3.7.2 1.5M downloads/30d#3,798 on PyPI2,272
Copyleft license GNU Lesser General Public License v3 or later (LGPLv3+) Active released

What it is and what it does

CasADi is a symbolic computation and optimization framework written in C++ with Python bindings. It provides automatic differentiation, allowing you to define optimization problems symbolically and have gradients computed automatically. The package is designed for researchers and engineers working on nonlinear optimization, optimal control, and algorithmic differentiation tasks where you need to compute derivatives efficiently without hand-coding them.

The framework depends only on numpy at runtime and offers prebuilt wheels for Python 2.7 and 3.4–3.12 across macOS, Windows, and Linux. It has been in production use since 2017 and maintains active development. The copyleft license means that if you modify CasADi itself, those changes must remain open-source; using it unmodified in a proprietary application is permitted but may require review of your use case.

Use it for:

  • Define and solve nonlinear optimization problems with automatic gradient computation
  • Implement optimal control algorithms where symbolic differentiation reduces implementation burden
  • Perform sensitivity analysis and parameter optimization in scientific computing workflows
  • Build embedded optimization routines for real-time control systems

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

CasADi is a framework for algorithmic differentiation and numeric optimization, providing symbolic computation and automatic differentiation capabilities for optimization problems.

Yes, if you need symbolic optimization with automatic differentiation. CasADi is actively maintained, has no known vulnerabilities, and offers broad platform support. The main consideration is the copyleft license: if you're building proprietary software, verify that using an unmodified library under LGPLv3+ aligns with your licensing strategy, or contact the maintainers about commercial options.

Install

casadi on PyPI

pip

pip install casadi

uv

uv add casadi

poetry

poetry add casadi

Installing casadi

Before you install

Medium install friction due to compiled C++ bindings, but prebuilt wheels are available for common Python versions (2.7, 3.10–3.12) and platforms (macOS, Windows, Linux). The project is actively maintained with a recent commit history and no known vulnerabilities.

License in practice

Licensed under LGPLv3+, a copyleft license requiring that derivative works and modifications remain open-source under the same license. Proprietary projects using CasADi must either comply with these terms or obtain a commercial license.

Quickstart

pip install casadi

import casadi as ca
import numpy as np

# Define a simple optimization variable
x = ca.SX.sym('x')
# Define objective and solve
objective = (x - 2)**2
solver = ca.nlpsol('solver', 'ipopt', {'x': x, 'f': objective})
result = solver(x0=0)

Requires a working C++ compiler or prebuilt wheel for your Python version and platform; wheels are provided for Python 2.7 and 3.4–3.12 on common architectures.

Verify before relying

  • Whether CasADi's symbolic computation model is suitable for real-time or embedded optimization tasks
  • Performance characteristics compared to other automatic differentiation frameworks for large-scale problems
  • Availability of commercial licensing options for proprietary use

Package facts

License GNU Lesser General Public License v3 or later (LGPLv3+) (copyleft)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 338 days since the last release
Last repo commit
First released
Downloads 1,536,190/month — #3,798 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: casadi-3.7.2-cp27-none-macosx_10_13_x86_64.macosx_10_13_intel.whl; casadi-3.7.2-cp27-none-manylinux1_i686.whl; casadi-3.7.2-cp27-none-manylinux2010_x86_64.whl; casadi-3.7.2-cp27-none-win_amd64.whl; casadi-3.7.2-cp310-none-macosx_10_13_x86_64.macosx_10_13_intel.whl; casadi-3.7.2-cp310-none-macosx_11_0_arm64.whl; casadi-3.7.2-cp310-none-manylinux2014_aarch64.whl; casadi-3.7.2-cp310-none-manylinux2014_i686.whl; casadi-3.7.2-cp310-none-manylinux2014_x86_64.whl; casadi-3.7.2-cp310-none-win_amd64.whl; casadi-3.7.2-cp311-none-macosx_10_13_x86_64.macosx_10_13_intel.whl; casadi-3.7.2-cp311-none-macosx_11_0_arm64.whl; casadi-3.7.2-cp311-none-manylinux2014_aarch64.whl; casadi-3.7.2-cp311-none-manylinux2014_i686.whl; casadi-3.7.2-cp311-none-manylinux2014_x86_64.whl; casadi-3.7.2-cp311-none-win_amd64.whl; casadi-3.7.2-cp312-none-macosx_10_13_x86_64.macosx_10_13_intel.whl; casadi-3.7.2-cp312-none-macosx_11_0_arm64.whl; casadi-3.7.2-cp312-none-manylinux2014_aarch64.whl; casadi-3.7.2-cp312-none-manylinux2014_i686.whl

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI ApprovedOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: C++Programming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Scientific/Engineering

Tags

automatic differentiation pythonsymbolic optimization frameworknumeric optimization libraryalgorithmic differentiation toolnonlinear optimization casadisymbolic math computationgradient computation framework
optimizationautomatic-differentiationsymbolic-computation

More Scientific/Engineering packages