nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
823 stars 134 forks source link

Javascript error with show_mdtraj #1124

Open VittoriaOssanna opened 2 weeks ago

VittoriaOssanna commented 2 weeks ago

Hello everyone,

I am having troubles in visualizing an mdtraj object with nglview. The code is very short, I was just running a small experiment:

import nglview
import mdtraj

trr = pathlib.Path('./test00/shots0/path000129.trr')
gro = pathlib.Path('./run.gro')

traj = mdtraj.load(str(trr), top=str(gro))
nglview.show_mdtraj(traj)

But shows me a javascript error that I can not define better

 at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4099813)
    at ph.loadClass (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4403287)
    at ph.loadModelClass (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4097773)
    at ph._make_model (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4094616)
    at ph.new_model (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4092246)
    at ph.handle_comm_open (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4091039)
    at https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-renderers-1.0.19/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4402511
    at n._handleCommOpen (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-2024.9.1-linux-x64/dist/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:3:80955)
    at async n._handleMessage (https://file+.vscode-resource.vscode-cdn.net/home/vittoria/.vscode/extensions/ms-toolsai.jupyter-2024.9.1-linux-x64/dist/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:3:82830)

I am using

Thank you for your support

hainm commented 5 days ago

Thank you for your report.

hainm commented 1 day ago

vscode

@VittoriaOssanna oh, versions > 3.0.8 have issue with vscode. Please use v3.0.8 for now.

hainm commented 1 day ago

Please try latest version, v3.1.4 pip3 install nglview==3.1.4 (conda version will be released later via conda-forge)