Cantera

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

Cantera is an open-source suite of tools for problems involving chemical kinetics, thermodynamics, and transport processes. Current version is 3.2.0, released November 2025. Major releases approximately yearly, with minor patches as needed.

pip install cantera
error ModuleNotFoundError: No module named 'cantera._cantera'
cause Cantera compiled extension missing; common when installed as source without proper build prerequisites.
fix
Use a precompiled wheel: pip install cantera --only-binary cantera. Or install build tools (Cython, compilers) for source build.
error RuntimeError: No such thermo XML node: 'NASA'
cause Attempting to load a YAML file that contains XML remnants or using XML parser on YAML. Cantera 3.x only reads YAML.
fix
Ensure the mechanism file is in YAML format. Convert .cti or .xml using cti2yaml or ck2yaml.
error AttributeError: module 'cantera' has no attribute 'Solution'
cause Old import style (from cantera import *) or very outdated version (<2.3).
fix
Use import cantera as ct then ct.Solution(...). Ensure Cantera >= 2.3.
breaking Cantera 3.0 removed support for .cti and .xml input files. Only .yaml (or .yml) mechanism files are supported.
fix Convert .cti files to .yaml using provided conversion script (cti2yaml) or update paths to use .yaml mechanisms.
breaking ThermoPhase objects no longer have methods like 'setTemperature' or 'setMoleFractions'. Use property assignment: gas.TP = (T, P); gas.X = composition_dict.
fix Replace old-style setters with direct property assignment. See migration guide.
deprecated The 'importInterface' function is deprecated and will be removed in Cantera 4.0. Use 'Interface' class directly.
fix Replace ct.importInterface('file.yaml', 'phase_name') with ct.Interface('file.yaml', 'phase_name').
gotcha Cantera on Windows may require Microsoft Visual C++ Redistributable. Missing it leads to 'DLL load failed' errors.
fix Install VC++ Redistributable from Microsoft (see Cantera installation docs).

Load GRI 3.0 mechanism, set temperature and pressure, and compute chemical equilibrium.

import cantera as ct

gas = ct.Solution('gri30.yaml')
gas.TP = 300, ct.one_atm
print('Mole fractions:', gas.X)

# Simple equilibrium
gas.equilibrate('HP')
print('Adiabatic flame T:', gas.T)