nglviewer / nglview

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

Nglview freezes with jupyter-lab #759

Closed sperezconesa closed 5 years ago

sperezconesa commented 5 years ago

Hello, I have recently installed nglview in jupyter-lab and I am having some problems. This works perfectly:

import MDAnalysis as MDA
import nglview as nv
v = nv.demo()
v

or

u = MDA.Universe('conf.pdb')
not_wat = u.select_atoms("not name OW HW q")
view = nv.show_mdanalysis(not_wat)

The configs and the trajectories are of 9056 (3600 non-solvent) atoms. And these systems used to work on the jupyter-lab before the reinstallation.

On the other hand, using these universes, the notebook freezes:

u = MDA.Universe('topo.psf','traj_comp.xtc')
# I get some warnings:
#758 /home/sergio/bin/anaconda3/envs/lab_ngl/lib/python3.6/site-packages/MDAnalysis/coordinates/XDR.py:195: UserWarning: Reload offsets from trajectory
 ctime or size or n_atoms did not match
  warnings.warn("Reload offsets from trajectory\n "
/home/sergio/bin/anaconda3/envs/lab_ngl/lib/python3.6/site-packages/MDAnalysis/coordinates/PDB.py:902: UserWarning: Found no information for attr: 'altLocs' Using default value of ' '
  "".format(attrname, default))
/home/sergio/bin/anaconda3/envs/lab_ngl/lib/python3.6/site-packages/MDAnalysis/coordinates/PDB.py:902: UserWarning: Found no information for attr: 'icodes' Using default value of ' '
  "".format(attrname, default))
/home/sergio/bin/anaconda3/envs/lab_ngl/lib/python3.6/site-packages/MDAnalysis/coordinates/PDB.py:902: UserWarning: Found no information for attr: 'occupancies' Using default value of '1.0'
  "".format(attrname, default))
/home/sergio/bin/anaconda3/envs/lab_ngl/lib/python3.6/site-packages/MDAnalysis/coordinates/PDB.py:902: UserWarning: Found no information for attr: 'tempfactors' Using default value of '0.0'
  "".format(attrname, default))
or
u = MDA.Universe('conf.gro')
# No warnings but still freezes.
not_wat = u.select_atoms("not name OW HW q")
view = nv.show_mdanalysis(not_wat)

The versions are

I have just made a fresh Anaconda start doing this:

 ./Anconda
 conda install jupyterlab MDAnalysis sympy
 conda install nodejs
 pip install ipympl
 jupyter labextension install @jupyter-widgets/jupyterlab-manager
 jupyter labextension install jupyter-matplotlib
#Modified c.NotebookApp.iopub_data_rate_limit = 10000000
 vi .jupyter/jupyter_notebook_config.py
 pip install ipywidgets
  pip install nglview
 nglview enable
 jupyter-labextension install nglview-js-widgets
jupyter-lab build

Thank you all in advance!! Best regards, Sergio

hainm commented 5 years ago

Thank you for your report. We will investigate it.

hainm commented 5 years ago

@sperezconesa So I've reread your comments and I am not sure what is freezing. Have you tried without nglview yet? If that's nglview's issue, can you please attach a notebook + file(s) to reproduce the issue? thanks.

sperezconesa commented 5 years ago

The whole jupyterlab freezes. I think it is a nglview issue because it does not happen with any other library. I have attached the files. The .gro and psf work properly on vmd.

nglview.zip

Thank you! Sergio

hainm commented 5 years ago

thanks @sperezconesa. I can reproduce the issue with jupyter-lab. Oddly, the example works fine with the jupyter-notebook.

screen shot 2018-11-27 at 9 57 04 pm
sperezconesa commented 5 years ago

That is weird... Is there any way else I can help?

hainm commented 5 years ago

I think this is due to the jupyterlab (given that the notebook is ok). Let me do some digging and will report to lab issue to see if there is any solution. Thanks.

sperezconesa commented 5 years ago

Great! Thank you very much. Sergio

hainm commented 5 years ago

uhm, there's already an open issue in jupyterlab: https://github.com/jupyterlab/jupyterlab/issues/5399

sperezconesa commented 5 years ago

Great! Thank you.

sperezconesa commented 5 years ago

Hello, I have updated nglview and now I get: Error displaying widget

sperezconesa commented 5 years ago

On chrome's developer console I get: renderer.js:45 Error displaying widget renderer.js:46 Module nglview-js-widgets, semver range 1.1.7 is not registered as a widget module  ​

hainm commented 5 years ago

yeah, that's expected since you need to install nglview-js-widgets@1.1.7 by jupyter-labextension again. This version does not exist. I will work on this, may be release nglview 1.1.9 and nglview-js-widgets@1.1.9

sperezconesa commented 5 years ago

So, I have to wait untill you update, right? Thank you very much!

hainm commented 5 years ago

yeah right.

jan-janssen commented 5 years ago

This should be fixed in https://github.com/arose/nglview/pull/773

hainm commented 5 years ago

@sperezconesa Please try

pip install nglview==1.1.9
jupyter-labextension install nglview-js-widgets@1.1.9
sperezconesa commented 5 years ago

Great! It's working. Thank you very much :)

hainm commented 5 years ago

@sperezconesa does the freezing still happen in the latest lab?

sperezconesa commented 5 years ago

With 4.6.11 y have had no problem. I have yet to try 4.6.14. By he way I have had a problem between nglview and the matplotlib jupyter-lab extension. Essentially if I install nglview the matplotlib extension does not work well. If you would like to help me its in this thread: https://github.com/matplotlib/jupyter-matplotlib/issues/80#issuecomment-494832454 . Thank you in advance!

hainm commented 5 years ago

Thanks. I have no clue about matplotlub issue but I will “watch” that issue. Close this issue now.