Registry / database / pyensembl

pyensembl

JSON →
library2.10.1pypypi✓ verified 86d ago

Python interface to Ensembl reference genome metadata. Provides lazy-loading access to Ensembl databases for annotation, sequence retrieval, and genome assembly metadata. Current version: 2.10.1, requires Python >=3.9. Releases follow Ensembl releases, with periodic updates.

pip install pyensembl
INSTALL
IMPORT
SIG · PYENSEMBL
P
pyensembl
databasepythonv2.10.1
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.

EnsemblRelease
from pyensembl import EnsemblRelease
import pyensembl
Direct import of EnsemblRelease is required; pyensembl module itself is not callable.

Fetch genes from Ensembl release 75 on chromosome 6.

from pyensembl import EnsemblRelease data = EnsemblRelease(75) gene = data.genes_by_locus(6, 100_000_000, 110_000_000)[0] print(gene) print(gene.gene_id) print(gene.transcripts[0].cdna)
Debug
Known issues
gotchaEnsemblRelease(75) uses release 75 (GRCh37). To use GRCh38, use release >= 100 (e.g., EnsemblRelease(100)). The default EnsemblRelease() uses the latest cached release, which may be unexpected.
fix
Always specify an explicit release number to avoid ambiguity.
affects: All
gotchaCoordinate system: loci are 1-based and inclusive. This differs from Python's 0-based slicing. Incorrect bounds can lead to missing results.
fix
Use 1-based, inclusive coordinates. For an interval from 100,000,000 to 110,000,000, call genes_by_locus(6, 100_000_000, 110_000_000).
affects: All
deprecatedThe 'from pyensembl import cached_release' pattern is deprecated as of version 2.0. Use 'from pyensembl import EnsemblRelease' and instantiate with a release number.
fix
Use EnsemblRelease(104) instead of cached_release().
affects: >=2.0
Errors
Common errors & fixes
ValueError: Release number 75 is not cached.
The required Ensembl release data has not been downloaded or cached. pyensembl downloads data on first use for a given release.
fix
Trigger download explicitly: EnsemblRelease(75).download() before querying.
AttributeError: module 'pyensembl' has no attribute 'EnsemblRelease'
Importing pyensembl directly instead of from pyensembl import EnsemblRelease.
fix
Use: from pyensembl import EnsemblRelease
Upgrade
Version history
2.10.1latest on PyPI · released May 13, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources

No resource links recorded.

pyensembl — pip install pyensembl · libregistry