skillfed

mrcfile

MRC file I/O library

mrcfile v1.5.4 434.1K downloads/30d#6,696 on PyPI86
Permissive license BSD Active released

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 mrcfile

uv

uv add mrcfile

poetry

poetry add mrcfile

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Bio-InformaticsTopic :: Software Development :: Libraries :: Python Modules

Tags

MRC file format reader writerstructural biology image datacryo-EM file I/Ovolume data storage pythonMRC2014 format supportnumpy array file formatelectron microscopy data
structural-biologyfile-formatscientific-computing

More Python Modules packages