Install & Compatibility
Where this runs
tested against v0.14 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.194s · 30.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.2s · import 0.178s · 31MB
28MB installed
● package 28MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
create_db
✓ import gffutils
✗ from gffutils import create_db
create_db is not a top-level function; use gffutils.create_db (it's a module-level attribute after import).
Create an in-memory GFF database from a string and query features.
import gffutils
# Download a sample GFF file or use your own
# For this example, we'll use an in-memory database
import os
db = gffutils.create_db(':memory:', from_string='##gff-version 3\nchr1\t.\tgene\t1\t1000\t.\t+\t.\tID=gene1\nchr1\t.\texon\t100\t200\t.\t+\t.\tID=exon1;Parent=gene1\n', force=True, keep_order=True)
gene = db['gene1']
print(gene.id, gene.seqid, gene.start, gene.end)
# Query all features
exons = db.children('gene1', featuretype='exon')
for exon in exons:
print(exon.id, exon.start, exon.end)
Errors
Common errors & fixes
sqlite3.OperationalError: no such table: features
The database file exists but is empty or not a valid gffutils database (e.g., created without force=True and not overwritten).
fixDelete the existing database file and recreate it with force=True.
AttributeError: module 'gffutils' has no attribute 'create_db'
Importing the module incorrectly (e.g., from gffutils import create_db) when the function is not a direct attribute.
fixUse: import gffutils; db = gffutils.create_db(...)
ValueError: No valid ID found for feature type 'gene'. Please specify an id_spec.
The GFF/GTF file does not have an 'ID' attribute for genes (common in GTF format) or the attribute name differs.
fixProvide an id_spec dictionary mapping feature types to attribute names, e.g., id_spec={'gene': 'gene_id', 'transcript': 'transcript_id'} Upgrade
Version history
0.14latest on PyPI · released Mar 31, 2026
Audit
Dependencies
No dependency data recorded yet.