skillfed

py3Dmol

An IPython interface for embedding 3Dmol.js views in Jupyter notebooks

py3dmol v2.5.5 427.3K downloads/30d#6,751 on PyPI
Permissive license MIT Active released

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 py3dmol

uv

uv add py3dmol

poetry

poetry add py3dmol

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Scientific/Engineering :: Bio-InformaticsTopic :: Scientific/Engineering :: ChemistryTopic :: Scientific/Engineering :: Visualization

Tags

jupyter 3d molecule viewerprotein structure visualizationmolecular structure display3dmol jupyter widgetinteractive pdb viewerchemical structure notebook3d molecular graphics
jupyter-widgetmolecular-visualizationstructural-biology

More Visualization packages