Registry / science / iapws
library1.5.5pypypi✓ verified 83d ago

Python implementation of international standards from the International Association for the Properties of Water and Steam (IAPWS). Provides thermodynamic properties of water and steam based on IAPWS-IF97 and related formulations. Current version: 1.5.5, updated 2024. Release cadence is irregular.

pip install iapws
INSTALL
IMPORT
SIG · IAPWS
I
iapws
sciencepythonv1.5.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IAPWS97
from iapws import IAPWS97
from iapws.iapws97 import IAPWS97
In versions prior to 1.5, the module structure was different; the recommended import is the top-level package.
IAPWS95
from iapws import IAPWS95
import iapws.IAPWS95
Using direct module import instead of the package-level symbol can break due to internal refactoring.

Create an IAPWS-IF97 steam object using pressure (MPa) and temperature (K), then access thermodynamic properties.

from iapws import IAPWS97 # Create steam object at 10 MPa and 500 K steam = IAPWS97(P=10, T=500) print(f"Density: {steam.rho:.3f} kg/m³") print(f"Enthalpy: {steam.h:.3f} kJ/kg") print(f"Entropy: {steam.s:.3f} kJ/kg·K")
Debug
Known issues
breakingIn version 1.5, the IAPWS97 class no longer accepts non-SI units (e.g., bar, °C). All inputs must be in MPa and K.
fix
Convert pressure to MPa and temperature to Kelvin before passing to the constructor.
affects: >=1.5
gotchaThe IAPWS97 class expects pressure in MPa, not kPa or bar. Common mistake: passing 10.0 thinking it's 10 bar yields incorrect results.
fix
Use 1.0 for 10 bar, or 0.1 for 1 bar. Always double-check units: 1 MPa = 10 bar = 1000 kPa.
affects: all
deprecatedThe function `iapws.iapws97._PS` is deprecated and will be removed in a future release. Use `IAPWS97(P=..., S=...)` constructor instead.
fix
Replace calls to `_PS(P, S)` with `IAPWS97(P=P, S=S)`.
affects: >=1.5
Errors
Common errors & fixes
AttributeError: module 'iapws' has no attribute 'IAPWS97'
Using an outdated version (<1.0) or incorrect import path.
fix
Upgrade with `pip install --upgrade iapws` and use `from iapws import IAPWS97`.
ValueError: Pressure out of range (0.001, 100) MPa
Pressure input is outside the valid range for IAPWS-IF97 (0.001 to 100 MPa).
fix
Ensure pressure is between 0.001 and 100 MPa. For lower pressures, use IAPWS95 if subcritical steam is needed.
TypeError: __init__() got an unexpected keyword argument 'T'
Using a deprecated keyword argument like 'T' in a function that expects only state variables in specific order.
fix
Use the correct constructor for IAPWS97: `IAPWS97(P=..., T=...)` or `IAPWS97(P=..., h=...)`. Check the official API.
Upgrade
Version history
1.5.5latest on PyPI · released Mar 27, 2026
Audit
Dependencies
numpyrequiredRequired for numerical operations in property calculations.
scipyrequiredUsed for root-finding and integration in some models.
Agent activity
52 hits · last 30 days
node
46
OpenAI (training)
1
Resources
iapws — pip install iapws · libregistry