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 nglviewVerified import paths — ran on the pinned version, not inferred.
Load a molecular structure from a PDB ID or local file and display the interactive 3D viewer in a Jupyter notebook.
For JupyterLab, run: `jupyter labextension install nglview-js-widgets` or use conda.
Run: `jupyter nbextension enable nglview --py --sys-prefix`
Update code to use `nglview.NGLWidget` and handle async initialization with `view._init_signals()` if needed.
Always provide topology via `traj.add_topology()` or pass topology file to `show_mdtraj()` / `show_mdanalysis()`.
`pip install nglview` or `conda install -c conda-forge nglview`
In JupyterLab: `jupyter labextension install nglview-js-widgets` and restart Jupyter.
Upgrade ipywidgets: `pip install --upgrade ipywidgets` and `jupyter nbextension enable --py widgetsnbextension`.