mrcfile
MRC file I/O library
What it is and what it does
mrcfile is a Python library for reading and writing MRC2014 format files, the standard format for storing 3D image and volume data in structural biology and cryo-electron microscopy. It provides a clean, simple API that exposes file headers and data as numpy arrays, making it easy to inspect, modify, and save MRC files without compiled dependencies beyond numpy itself.
The library supports gzip and bzip2 compressed files, includes validation against the MRC2014 specification, and offers memory-mapped access for efficient random access to large files. It runs on Python 2.7 and modern Python 3 versions across Linux, macOS, and Windows, and is actively maintained as part of the CCP-EM software suite used in structural biology research.
Use it for:
- Load and inspect 3D electron microscopy density maps in cryo-EM workflows
- Create and modify MRC format files programmatically in image processing pipelines
- Validate MRC file headers and data compliance with the MRC2014 standard
- Access large volume datasets efficiently using memory-mapped file mode
- Convert between MRC format and numpy arrays for analysis in scientific Python code
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mrcfile reads and writes MRC2014 format files used in structural biology to store image and volume data, exposing headers and data as numpy arrays through a simple Python API.
Yes. mrcfile is a stable, actively maintained library with low install friction (numpy only) and no known vulnerabilities. It fills a specific, well-defined role in structural biology workflows. Install it if you work with MRC format files in cryo-EM or related fields; skip it if you have no need for MRC file I/O.
Install
mrcfile on PyPI
pip
pip install mrcfileuv
uv add mrcfilepoetry
poetry add mrcfileInstalling mrcfile
Before you install
Low friction: pure Python wheel with only numpy as a runtime dependency. Active maintenance with recent commits and a stable release history since 2016.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install mrcfile
import mrcfile
import numpy as np
with mrcfile.open('file.mrc') as mrc:
data_slice = mrc.data[10, 10]
array = np.zeros((5, 5), dtype=np.int8)
with mrcfile.new('output.mrc') as mrc:
mrc.set_data(array)
mrc.data[1:4, 1:4] = 10
Verify before relying
- Whether memory-mapped and asynchronous file loading features are production-ready and documented
- Performance characteristics for very large files relative to alternatives
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 569 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 434,123/month — #6,696 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mrcfile-1.5.4-py2.py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
rosettasciioRosettaSciIO reads and writes scientific data…
copyleft · top 15,000 on PyPI
modelcifReads and writes mmCIF and BinaryCIF files…
permissive · top 15,000 on PyPI
ome-zarrReads and writes multi-resolution images stored…
permissive · top 15,000 on PyPI
ihmReads and writes mmCIF and BinaryCIF files…
permissive · top 15,000 on PyPI
mmcif-pdbxProvides a pure Python interface to read,…
permissive · top 15,000 on PyPI
gemmiGemmi is a C++ library with Python bindings for…
copyleft · top 5,000 on PyPI
mmcifProvides native Python and C++ bindings to…
permissive · top 5,000 on PyPI
safetensorsSerializes and deserializes tensors to and from…
permissive · top 1,000 on PyPI
python-libsbmlProvides Python bindings to read, write, and…
copyleft · top 15,000 on PyPI
fitsiofitsio reads and writes FITS (Flexible Image…
copyleft · top 15,000 on PyPI