chemicals

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

Chemical properties component of the Chemical Engineering Design Library (ChEDL). Provides pure component and mixture properties, phase equilibria, transport properties, and reaction stoichiometry. Current version 1.5.1, released regularly.

pip install chemicals
error ModuleNotFoundError: No module named 'chemicals'
cause The package is not installed.
fix
Run: pip install chemicals
error KeyError: 'water'
cause Chemical name not found in the database. 'water' is correct, but misspelled names or uncommon synonyms may fail.
fix
Use a valid name, CAS, or formula. For water, you can use 'water', '7732-18-5', or 'H2O'.
error AttributeError: module 'chemicals' has no attribute 'Chemical'
cause Incorrect import pattern. Chemical is not directly on the chemicals module; it is a class that must be imported explicitly.
fix
from chemicals import Chemical
error ValueError: Could not find unique CAS for 'propanol'
cause The name is ambiguous (1-propanol vs 2-propanol).
fix
Use a more specific name like '1-propanol' or 'isopropanol', or specify CAS number.
gotcha Chemical names can be ambiguous. Use CAS numbers or exact names to avoid picking the wrong isomer. e.g., 'ethanol' vs 'ethyl alcohol' both work, but 'propanol' raises an error due to multiple isomers.
fix Always specify a unique CAS number if possible, e.g., Chemical(CAS='64-17-5').
breaking In version 1.2.0, numpy 2.0 and scipy 1.14 compatibility introduced breaking changes for some internal routines. Old code relying on numpy <2.0 may break.
fix Upgrade chemicals to 1.3.0+ or pin numpy<2.0. For chemicals 1.2.0, ensure numpy 2.0 and scipy 1.14 compatibility is acceptable.
gotcha The 'chemicals' package uses the 'fluids' library as a dependency. If you installed it via pip, fluids is included, but if you manually install chemicals from source, ensure fluids >= 1.0.26 (since chemicals 1.2.0).
fix Run pip install 'chemicals' which auto-installs correct fluids version.
deprecated The function 'VaporPressure.from_method' using deprecated argument 'method' with string names might be removed. Use integer or method handle instead.
fix Use method as integer or use the new VaporPressure class directly.

Basic usage: instantiate a Chemical and compute properties.

from chemicals import Chemical
from chemicals.reaction import balance_stoichiometry

# Create a chemical object for water
H2O = Chemical('water')
print(f"Molecular weight: {H2O.MW} g/mol")
print(f"Critical temperature: {H2O.Tc} K")

# Balance a simple reaction
rxn = balance_stoichiometry(['H2', 'O2'], ['H2O'])
print(f"Balanced: {rxn}")