Registry / serialization / ihm
library2.11pypypi✓ verified 90d ago

A Python library for handling mmCIF and BinaryCIF files used in integrative/hybrid modeling, as defined by the wwPDB IHM extension. Version 2.10 is current. It supports reading, writing, and validating IHM mmCIF/BinaryCIF files, with features such as restraint representation, ensemble modeling, and reference sequence handling. The library is maintained by the IHM Working Group.

pip install ihm
INSTALL
IMPORT
SIG · IHM
I
ihm
serializationpythonv2.11
Install
3.4s avg
Import
93ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.094s · 20.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.4s · import 0.092s · 21MB
19MB installed
● package 19MB
Code
Verified usage

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

System
✓ from ihm import System
Assembly
✓ from ihm import Assembly
Model
✓ from ihm.model import Model
Restraint
✓ from ihm.restraint import Restraint
mmCIF writer
✓ from ihm.format import CifWriter

Minimal example: create a system with one protein entity, an asym unit, and an assembly, then write a mmCIF file.

import ihm import ihm.location import ihm.model import ihm.restraint # Create a minimal IHM system system = ihm.System() # Add a protein entity entity = ihm.Entity() entity.description = "My protein" entity.sequence = "MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHG" system.entities.append(entity) # Add an asym unit asym = ihm.AsymUnit(entity=entity, details="Chain A") system.asym_units.append(asym) # Create an assembly assembly = ihm.Assembly() assembly.append(asym) # Write a mmCIF string from io import StringIO from ihm.format import CifWriter out = StringIO() writer = CifWriter(out) writer.write(system) print(out.getvalue()[:500])
Debug
Known issues
gotchaThe 'ihm' library only supports Python 3.6+; Python 2 is not supported.
fix
Use Python 3.6 or later.
affects: >=2.0
deprecatedThe 'ihm.format.CifWriter' class replaced the older writer pattern. Use 'from ihm.format import CifWriter' instead of deprecated 'ihm.io' or 'ihm.cif'.
fix
Update imports to use 'from ihm.format import CifWriter'.
affects: >=2.0
gotchaWhen using BinaryCIF, the msgpack package is required but not installed by default; install with 'pip install ihm[bcif]' or manually.
fix
Run 'pip install msgpack' or 'pip install ihm[bcif]'.
affects: all
breakingIn version 2.0, the 'SeqDif' class was moved from 'ihm.reference' to 'ihm.reference.SeqDif' – old imports may break.
fix
Use 'from ihm.reference import SeqDif'.
affects: >=2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ihm'
Library not installed.
fix
Run 'pip install ihm'.
ModuleNotFoundError: No module named 'msgpack'
msgpack not installed, required for BinaryCIF support.
fix
Run 'pip install msgpack' or 'pip install ihm[bcif]'.
AttributeError: module 'ihm' has no attribute 'CifWriter'
Incorrect import path; CifWriter is in ihm.format.
fix
Use 'from ihm.format import CifWriter'.
ValueError: invalid character in entity sequence
Entity sequence contains invalid characters (only standard amino acid codes allowed).
fix
Check sequence for non-standard characters; use 'X' or 'O' for non-standard as needed.
Upgrade
Version history
2.11latest on PyPI · released Jun 5, 2026
Audit
Dependencies
msgpackoptionalUsed for BinaryCIF encoding/decoding.
Agent activity
15 hits · last 30 days
node
14
Anthropic
1
Resources
ihm — pip install ihm · libregistry