Registry / data / nglview

nglview

JSON →
library4.0.1pypypi✓ verified 84d ago

NGLView provides an IPython/Jupyter widget to interactively view molecular structures and trajectories using the NGL Viewer. It supports various file formats (PDB, SDF, MOL2, XYZ, etc.) and integrates with MDTraj, MDAnalysis, and OpenMM. Version 4.0.1 supports Python >=3.7. Development is active on GitHub.

pip install nglview
INSTALL
IMPORT
SIG · NGLVIEW
N
nglview
datapythonv4.0.1
Install
22.8s avg
Import
2150ms
Disk
354MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.1 · 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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 2.214s · 360.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 22.8s · import 2.085s · 341MB
354MB installed
● package 354MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nglview
import nglview as nv
None
Standard import with alias nv.

Load a molecular structure from a PDB ID or local file and display the interactive 3D viewer in a Jupyter notebook.

import nglview as nv import os # Use a built-in example (PDB ID 1CRN) view = nv.show_pdbid("1CRN") view # To view a local file: # view = nv.show_file("protein.pdb")
Debug
Known issues
gotchaIn JupyterLab, you must install the labextension separately: `jupyter labextension install nglview-js-widgets` or use `conda install -c conda-forge nglview` which includes it.
fix
For JupyterLab, run: `jupyter labextension install nglview-js-widgets` or use conda.
affects: all in JupyterLab
gotchaIf the widget does not render, you may need to enable the notebook extension: `jupyter nbextension enable nglview --py --sys-prefix`.
fix
Run: `jupyter nbextension enable nglview --py --sys-prefix`
affects: all
breakingVersion 3.x had breaking changes in the widget API (e.g., `widget.NGLWidget` renamed, asynchronous initialization). Code written for 2.x may not work in 3.x.
fix
Update code to use `nglview.NGLWidget` and handle async initialization with `view._init_signals()` if needed.
affects: 3.0+
gotchaTrajectory loading with `add_trajectory()` may fail if the topology file is not provided or mismatched.
fix
Always provide topology via `traj.add_topology()` or pass topology file to `show_mdtraj()` / `show_mdanalysis()`.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'nglview'
NGLView is not installed.
fix
`pip install nglview` or `conda install -c conda-forge nglview`
Error displaying widget: model not found
JupyterLab extension not installed or nglview-js-widgets missing.
fix
In JupyterLab: `jupyter labextension install nglview-js-widgets` and restart Jupyter.
Javascript Error: Cannot read property 'on' of undefined
Outdated or mismatched ipywidgets version.
fix
Upgrade ipywidgets: `pip install --upgrade ipywidgets` and `jupyter nbextension enable --py widgetsnbextension`.
Upgrade
Version history
4.0.1latest on PyPI · released Feb 2, 2026
Audit
Dependencies
ipywidgetsrequiredCore dependency for Jupyter widget.
notebookoptionalRequired for notebook extension installation.
Agent activity
4 hits · last 30 days
node
4
Resources
nglview — pip install nglview · libregistry