nglviewer / nglview

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

VSCode : receiving java script error while running nv.demo() #1085

Open Panzer-vor-08 opened 10 months ago

Panzer-vor-08 commented 10 months ago

I am using VSCode editor to run a .ipynb file

this is my code in VScode editor (in one single cell)

import nglview as nv
view = nv.demo()
view

here are the error messages ` at ph.loadClass (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4099813)

at ph.loadClass (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4403287)

at ph.loadModelClass (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4097773)

at ph._make_model (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4094616)

at ph.new_model (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4092246)

at ph.handle_comm_open (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4091039)

at https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.0.17/out/node_modules/%40vscode/jupyter-ipywidgets8/dist/ipywidgets.js:2:4402511

at r._handleCommOpen (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-2023.10.1100000000-linux-x64/out/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:9:114159)

at async r._handleMessage (https://vscode-remote+ssh-002dremote-002bibs-005fserver.vscode-resource.vscode-cdn.net/data/Wu_Feizhen/wfz02/.vscode-server/extensions/ms-toolsai.jupyter-2023.10.1100000000-linux-x64/out/webviews/webview-side/ipywidgetsKernel/ipywidgetsKernel.js:9:116034)`

and no structure was displayed

Panzer-vor-08 commented 10 months ago
屏幕截图 2023-11-17 100447
hainm commented 10 months ago

sorry @Panzer-vor-08. I have developed/tried nglview with VSCode so I don't know the answer.

does below work for you?

from ipywidgets import Text
Text("HELLO")
Panzer-vor-08 commented 10 months ago
屏幕截图 2023-11-17 235015

it seems to work properly

OWissett commented 8 months ago

I too have this problem...

OWissett commented 8 months ago

I am running Python 3.11.7, in a mamba 1.4.2 env, using jupyter 1.0.0, ipywidgets 8.1.1

hainm commented 8 months ago

sorry guys, I have 0-knowledge about VSCode.😭

watanabeaisora35 commented 8 months ago

I also had this problem in VScode.

Screenshot 2024-02-05 at 11 12 06 AM

"Error: No version of module nglview-js-widgets is registered" Anyone knows how to solve this problem?

OWissett commented 8 months ago

I found as a work around, just use a different protein viewer package. I am using py3dmol which seems to work better with VSCode

hnguyentt commented 7 months ago

I faced the same problem. Has anyone had a workaround for this?

sH4MbLe5 commented 7 months ago

Same here...

kizzhang commented 6 months ago

I managed to resolve this issue. I downgraded ipywidgets and nglview. Now my linux system has ipywidgets=8.0.6 and nglview=3.0.6.

Abhishaike commented 5 months ago

Having the exact same problem, the above fix here: https://github.com/nglviewer/nglview/issues/1085#issuecomment-1986746977 did not work for me

Heezch commented 4 months ago

I have also encountered the same issue... at some point it worked to indeed downgrade to nglview==3.0.8 ipywidgets==8.1.1 jupyterlab>4 , but this does not seem stable...

Small update:

See below a combination of versions that seem to work in VScode on MacOS (ARM silicon). After creating a new env also completely quit the VScode application and then restart before trying the import ngvliew nglview.demo()

python 3.12.3 jupyterlab 4.1.5
ipykernel 6.29.3
ipython 8.24.0
ipywidgets 8.0.6
nglview 3.0.6