Registry / analytics / pymzml

pymzml

JSON →
library2.6.0pypypi✓ verified 86d ago

High-throughput mzML file parsing for mass spectrometry data. Current version 2.6.0, compatible with Python >=3.7. Released irregularly; last stable release Oct 2024.

pip install pymzml
INSTALL
IMPORT
SIG · PYMZML
P
pymzml
analyticspythonv2.6.0
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.

run
from pymzml import run
import pymzml
pymzml is not a module with attributes; use 'from pymzml import run' to get the reader.

Read an mzML file and iterate over spectra. Replace the URL with a local path.

from pymzml import run example_file = 'https://github.com/pymzml/pymzML/raw/main/tests/testdata/example.mzML' reader = run.Reader(example_file) for spectrum in reader: print(spectrum['id'], spectrum['m/z array'].shape)
Debug
Known issues
breakingpymzML 2.x changed the Reader API: 'run.Reader' replaces 'MzMLReader'. Old code using 'from pymzml import MzMLReader' will fail.
fix
Use 'from pymzml import run; reader = run.Reader(file)' instead.
affects: >=2.0.0
deprecatedThe 'get_spectrum' method is deprecated; use iteration over the Reader or indexing with spectrum IDs.
fix
Replace 'reader.get_spectrum(id)' with 'reader[id]' or loop over 'reader'.
affects: >=2.5.0
gotchaFile paths must be either local files or valid URLs. Relative paths may not resolve correctly; use absolute paths or os.path.abspath().
fix
Pass an absolute path or a proper URL.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pymzml' has no attribute 'run'
Importing pymzml directly; run is a submodule not imported by default.
fix
Use: from pymzml import run
ValueError: File not found: ...
The file path is relative and Python's working directory does not match.
fix
Provide an absolute path or download the file and pass the absolute path.
Upgrade
Version history
2.6.0latest on PyPI · released Dec 10, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources
pymzml — pip install pymzml · libregistry