Install & Compatibility
Where this runs
tested against v1.7 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.106s · 20.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.6s · import 0.096s · 22MB
19MB installed
● package 19MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
System
✓ from modelcif import System
✗ from modelcif.system import System
System is in top-level __init__.py, not a separate module.
Model
✓ from modelcif.model import Model
✗ from modelcif import Model
Model class is in modelcif.model module.
TargetReference
✓ from modelcif.reference import TargetReference
✗ from modelcif import TargetReference
TargetReference is in the reference submodule.
Create a minimal ModelCIF system with one model, write it to a mmCIF file, and read it back.
import modelcif
import modelcif.reader
import modelcif.model
import tempfile, os
# create a simple system
sys = modelcif.System("Example model")
# add a model
model = modelcif.model.Model(sys, "model_1")
# write to a temporary file
with tempfile.NamedTemporaryFile(suffix='.cif', delete=False) as f:
fname = f.name
sys.write(fname)
# read back
sys2 = modelcif.reader.read(fname)
print(len(sys2.models))
os.unlink(fname)
Errors
Common errors & fixes
ImportError: cannot import name 'System' from 'modelcif'
Attempting to import from a submodule that does not exist or wrong casing.
fixUse 'from modelcif import System'.
AttributeError: 'System' object has no attribute 'write'
Using an older version of modelcif where write is not a method of System; it may be accessed via a different API.
fixEnsure you have modelcif >=0.7 and use sys.write(filename).
TypeError: __init__() got an unexpected keyword argument 'align_begin'
Deprecated argument used with TargetReference in modelcif >=1.0.
fixRemove align_begin and align_end; use the new reference sequence API.
Upgrade
Version history
1.7latest on PyPI · released Apr 11, 2026
Audit
Dependencies
ihmrequiredCore dependency for mmCIF handling; modelcif extends ihm classes.