py3Dmol
An IPython interface for embedding 3Dmol.js views in Jupyter notebooks
What it is and what it does
py3Dmol is a Jupyter widget that wraps 3Dmol.js to display interactive 3D molecular structures in notebooks. It lets you query structures by PDB ID or load custom molecular data, then style and manipulate them using the 3Dmol.js API—all without needing a running kernel after the cell executes. The viewer renders as static HTML, so notebooks exported to web pages or presentations retain full interactivity.
The package has no runtime dependencies beyond Python itself, making it lightweight to install. It's designed for researchers and developers working with protein structures, chemical compounds, and other molecular data in computational notebooks. One-way communication means the notebook cannot programmatically read back viewer state, only send commands to it.
Use it for:
- Display protein structures from the Protein Data Bank by PDB ID in research notebooks.
- Visualize molecular docking results or simulation frames with custom styling and coloring.
- Create interactive molecular structure figures for presentations and publications exported from notebooks.
- Teach structural biology or chemistry by embedding explorable 3D models directly in course materials.
- Inspect and annotate chemical compound structures during drug discovery workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Embeds an interactive 3D molecular viewer in Jupyter notebooks using 3Dmol.js, allowing visualization and manipulation of protein and molecular structures directly in the notebook.
Yes, if you work with molecular structures in Jupyter notebooks. Installation is frictionless, maintenance is active, the MIT license is permissive, and there are no known vulnerabilities. The static rendering model makes it reliable for sharing notebooks and exporting to web. Not needed if you don't use Jupyter or don't work with 3D molecular data.
Install
py3dmol on PyPI
pip
pip install py3dmoluv
uv add py3dmolpoetry
poetry add py3dmolInstalling py3Dmol
Before you install
Low friction installation with no runtime dependencies. Last release 83 days ago with active maintenance status.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install py3Dmol
import py3Dmol
view = py3Dmol.view(query='pdb:1ubq')
view.setStyle({'cartoon':{'color':'spectrum'}})
view
Requires Jupyter notebook environment to display the interactive viewer; static output works in web pages and presentations generated from notebooks.
Verify before relying
- Whether the package supports Python 2 in practice given its 2016 origin and the Python 2 classifier—Python 2 reached end-of-life in 2020.
- Current state of the upstream 3Dmol.js library and whether breaking changes have occurred since the last py3Dmol release.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 83 days since the last release |
| First released | |
| Downloads | 427,302/month — #6,751 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py3dmol-2.5.5-py2.py3-none-any.whl
Keywords: molecule, protein, visualization
Tags
More Visualization packages
matplotlib creates static, animated, and…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
plotlyPlotly is an interactive, browser-based…
permissive · top 1,000 on PyPI
graphvizGenerates DOT language source code for graph…
permissive · top 1,000 on PyPI
streamlitStreamlit transforms Python scripts into…
permissive · top 1,000 on PyPI
leatherLeather is a lightweight Python charting…
permissive · top 1,000 on PyPI
ipywidgetsipywidgets provides interactive HTML widgets…
permissive · top 1,000 on PyPI
ipyleafletipyleaflet embeds interactive Leaflet maps…
permissive · top 15,000 on PyPI
rerun-notebookProvides Jupyter notebook integration for…
permissive · top 15,000 on PyPI
mpld3Converts matplotlib plots to interactive D3.js…
permissive · top 15,000 on PyPI
ipytreeipytree provides a tree-structure widget for…
permissive · top 15,000 on PyPI
pythreejsPythreejs bridges Python and Three.js to render…
permissive · top 15,000 on PyPI
mediapyMediapy reads, writes, and displays images and…
permissive · top 5,000 on PyPI
jupyter-leafletjupyter-leaflet provides interactive map…
permissive · top 15,000 on PyPI
ipysigmaA Jupyter widget that renders interactive…
permissive · top 15,000 on PyPI
prolifProLIF generates interaction fingerprints from…
permissive · top 15,000 on PyPI