mhfp
Molecular MHFP fingerprints for cheminformatics applications
What it is and what it does
MHFP is a molecular fingerprinting algorithm that converts chemical structures (provided as SMILES strings or RDKit molecule objects) into compact hash-based representations suitable for fast similarity searching. It applies the MinHash method to circular substructures extracted from molecules, encoding structural detail up to six bonds (MHFP6). The fingerprints are designed to work with locality-sensitive hashing (LSH) for approximate nearest-neighbor search, enabling rapid retrieval of similar molecules from large chemical databases.
The package provides two main interfaces: MHFPEncoder for generating fingerprints and computing pairwise distances, and LSHForestHelper for building indexed structures that support fast approximate queries. It also includes SECFP (SMILES Extended Connectivity Fingerprint), a folded variant. The package is a thin Python wrapper around the fingerprinting logic and depends on RDKit for molecular parsing and NumPy for numerical operations.
Use it for:
- Virtual screening: find structurally similar drug candidates from a chemical library given a query molecule.
- Analog recovery: identify known compounds similar to a novel structure in benchmarking or hit-to-lead workflows.
- Approximate nearest-neighbor search: retrieve the k most similar molecules from a large dataset without exhaustive comparison.
- Molecular clustering: group compounds by structural similarity using fingerprint distances.
- Ligand-based design: compare test molecules against a reference set to assess novelty or redundancy.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Encodes molecular structures as MinHash fingerprints (MHFP6) for fast similarity search and nearest-neighbor queries using locality-sensitive hashing.
Yes, if you need fast molecular similarity search and can accept an unmaintained package. The algorithm is well-published and the code is stable, but verify RDKit compatibility with your environment and confirm the license terms before use. Not recommended for new projects requiring ongoing support or frequent updates.
Install
mhfp on PyPI
pip
pip install mhfpuv
uv add mhfppoetry
poetry add mhfpInstalling mhfp
Before you install
Low install friction with no runtime dependencies beyond RDKit and NumPy. Package is abandoned (last commit 2023-02-16, 1275 days ago) with no active maintenance, so expect no bug fixes or updates.
License in practice
License status is unclear—no SPDX identifier or raw license text provided. Verify the actual license terms at the repository before use in proprietary or copyleft-sensitive contexts.
Quickstart
pip install mhfp
from mhfp.encoder import MHFPEncoder
mhfp_encoder = MHFPEncoder()
fp = mhfp_encoder.encode('CCOC1=C(C=C(C=C1)S(=O)(=O)N(C)C)C2=NC(=O)C3=C(N2)C(=NN3C)C(C)(C)C')
dist = MHFPEncoder.distance(fp, fp)
Requires RDKit (cheminformatics library) and NumPy; RDKit must be installed separately and may have system-level dependencies.
Verify before relying
- Whether the package's license is compatible with your use case (license status is unclear in the metadata).
- Current stability and compatibility with recent RDKit and NumPy versions, given the package has not been updated since 2023.
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,275 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 86,738/month — #13,842 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mhfp-1.9.6-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
aimsim-coreProvides core molecular featurization and…
permissive · top 15,000 on PyPI
selfiesConverts between SELFIES (Self-Referencing…
permissive · top 15,000 on PyPI
padelpyPaDELPy wraps the PaDEL-Descriptor Java engine…
permissive · top 15,000 on PyPI
nmslibnmslib provides efficient similarity search in…
unclear · top 15,000 on PyPI
simhashComputes Simhash fingerprints for text and…
permissive · top 15,000 on PyPI
datasketchProvides probabilistic data structures…
permissive · top 5,000 on PyPI
prolifProLIF generates interaction fingerprints from…
permissive · top 15,000 on PyPI
rensaRensa computes MinHash signatures for fast…
permissive · top 15,000 on PyPI
voyagerVoyager performs fast approximate…
permissive · top 15,000 on PyPI
PubChemPyPubChemPy is a Python wrapper around the…
permissive · top 5,000 on PyPI