Install & Compatibility
Where this runs
tested against v1.88 · 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
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.6s · import 0.102s · 105MB
108MB installed
● package 108MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Seq
✓ from Bio.Seq import Seq
Core sequence object.
SeqIO
✓ from Bio import SeqIO
Module for reading and writing sequence file formats.
Align
✓ from Bio import Align
Module for sequence alignment functionality.
PDB
✓ from Bio import PDB
Module for working with protein structures.
Entrez
✓ from Bio import Entrez
Module for accessing NCBI's Entrez databases.
Alphabet
✓ No direct equivalent
✗ from Bio.Alphabet import generic_dna
The Bio.Alphabet module was removed in Biopython 1.78. Sequence objects now handle molecule type as a string in SeqRecord annotations or by inferring from context. Explicit alphabet arguments should be removed.
Fasta
✓ from Bio import SeqIO
✗ from Bio import Fasta
The Bio.Fasta module was deprecated in 1.51 and removed in 1.55. Use Bio.SeqIO.parse() with format='fasta' instead.
This quickstart demonstrates creating and manipulating a Bio.Seq object, and then parsing a FASTA file using Bio.SeqIO.parse, which is a common task in bioinformatics. It includes creating a temporary FASTA file to make the example runnable.
import os
from Bio.Seq import Seq
from Bio import SeqIO
# 1. Working with a basic sequence
my_dna = Seq("ATGACGTACGT")
print(f"Original DNA: {my_dna}")
print(f"Complement: {my_dna.complement()}")
print(f"Reverse Complement: {my_dna.reverse_complement()}")
print(f"Translated protein: {my_dna.translate()}")
# 2. Parsing a FASTA file
# Create a dummy FASTA file for demonstration
fasta_content = (
">seq1 description for sequence 1\n"
"ATGCGTACGTAGCTAGCTAGCATGCAGCTAGCATGCGATGC\n"
">seq2 description for sequence 2\n"
"GATCGATCGATCGATCGATCGATCGATCGATCGATCGA"
)
with open("example.fasta", "w") as f:
f.write(fasta_content)
print("\n--- Parsing example.fasta ---")
for seq_record in SeqIO.parse("example.fasta", "fasta"):
print(f"ID: {seq_record.id}")
print(f"Description: {seq_record.description}")
print(f"Sequence: {seq_record.seq}")
print(f"Length: {len(seq_record.seq)}")
# Clean up the dummy file
os.remove("example.fasta")
Debug
Known issues
breakingThe `Bio.Alphabet` module was removed in Biopython 1.78 (September 2020). Explicit `alphabet` arguments for `Seq` objects are no longer supported, and molecule type is often inferred or stored as a string in `SeqRecord.annotations['molecule_type']`.fixRemove `alphabet` arguments from `Bio.Seq.Seq` constructors. Access molecule type via `SeqRecord.annotations.get('molecule_type')` if needed. affects: >=1.78
breakingThe `Bio.Fasta` module was deprecated in Biopython 1.51 (August 2009) and removed in Biopython 1.55 (August 2010).fixMigrate code to use `Bio.SeqIO.parse()` or `Bio.SeqIO.read()` with `format='fasta'` for FASTA file parsing.
affects: >=1.55
breakingSupport for Python 2.7 was dropped in Biopython 1.77 (2020), in line with Python 2.7's end-of-life.fixUpgrade to Python 3.10 or newer. Biopython 1.87 officially supports Python 3.10-3.14.
affects: >=1.77
deprecatedThe use of command-line tool wrappers in modules like `Bio.Applications` was deprecated in Biopython 1.78. They are no longer recommended due to potential security and compatibility issues.fixConsider using Python's `subprocess` module directly to call external tools, or investigate dedicated Python wrappers if available.
affects: >=1.78
gotchaFASTA file parsing became stricter in Biopython 1.85, and as of 1.87, lines before the first '>' are no longer interpreted as comments but cause errors if they are not empty. This can break parsing of some non-standard FASTA files.fixEnsure FASTA files strictly start with a `>` character for the first sequence header, or an empty line if not. Remove any preamble text before the first record.
affects: >=1.85 (stricter), >=1.87 (removed comment tolerance)
deprecatedThe `.strand`, `.ref`, and `.ref_db` attributes of `SeqFeature` objects were temporarily removed in Biopython 1.82 without deprecation, then restored with deprecation warnings in 1.83. They are aliases for `.location.strand`, `.location.ref`, and `.location.ref_db` respectively.fixUpdate code to use `.location.strand`, `.location.ref`, and `.location.ref_db` directly.
affects: 1.82-1.87 (deprecated in 1.83)
deprecatedThe `setup.py` script for project metadata and build configuration was deprecated in Biopython 1.87 in favor of a `pyproject.toml`-based setup.fixFor contributors/developers, build systems should now respect `pyproject.toml`. Standard `pip install` users are unaffected.
affects: >=1.87
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'Bio'
This error occurs when the Biopython library is not installed in the active Python environment or Python cannot locate the 'Bio' module. It can also be due to case sensitivity issues (e.g., 'bio' instead of 'Bio') or environment activation problems.
fixInstall Biopython using pip: `pip install biopython` or `pip3 install biopython`. If using Anaconda, use `conda install biopython`. Ensure your Python environment is correctly activated.
ImportError: Bio.Alphabet has been removed from Biopython
The `Bio.Alphabet` module was removed in Biopython version 1.78. Code written for older versions of Biopython that relies on this module will fail with newer versions.
fixUpdate your code to remove references to `Bio.Alphabet`. For `SeqRecord` objects, specify `molecule_type` as an annotation if necessary. Alternatively, downgrade Biopython to a version prior to 1.78 if your project cannot be updated.
ValueError: More than one record found in handle
This error occurs when using `Bio.SeqIO.read()` on a file that contains multiple sequence records. The `read()` function is designed to process files containing *exactly one* record, raising an error if zero or more than one record is found.
fixIf the file contains multiple records, use `Bio.SeqIO.parse()` to iterate over them, for example: `from Bio import SeqIO; records = list(SeqIO.parse('your_file.fasta', 'fasta'))`. If you only want the first record from a multi-record file, use `next(SeqIO.parse('your_file.fasta', 'fasta'))`. KeyError: 'gene' (or other key) when accessing feature.qualifiers
This `KeyError` arises when attempting to access a specific qualifier (e.g., 'gene', 'product') from a `SeqFeature`'s `qualifiers` dictionary, but that particular key does not exist for the current feature. Not all features in a GenBank file, for example, will have every possible qualifier.
fixAlways check for the existence of a key in `feature.qualifiers` before attempting to access it directly, or use the `.get()` method with a default value. For example: `gene_name = feature.qualifiers.get('gene', ['unknown'])[0]` or `if 'gene' in feature.qualifiers: gene_name = feature.qualifiers['gene'][0]`. AttributeError: 'str' object has no attribute 'id'
This error typically occurs when a function or operation expects a `Bio.SeqRecord.SeqRecord` object (which has attributes like `.id`, `.seq`, `.description`), but instead receives a plain Python string. This often happens after parsing or filtering sequences if the result is inadvertently converted to a string before further processing.
fixEnsure that the object you are operating on is a `SeqRecord` object, not a string. If you are iterating through `SeqIO.parse()`, each item yielded is a `SeqRecord`. If you have a string and need to convert it to a `SeqRecord`, create one explicitly: `from Bio.Seq import Seq; from Bio.SeqRecord import SeqRecord; record = SeqRecord(Seq('YOUR_SEQUENCE_STRING'), id='your_id')`. Upgrade
Version history
1.88latest on PyPI · released Aug 6, 2026
Audit
Dependencies
numpyrequiredRequired for many numerical operations, especially in modules like Bio.PDB and Bio.Align.
reportlaboptionalOptional, used by Bio.Graphics for generating graphical outputs.
matplotliboptionalOptional, used for various plotting functionalities.