nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories

Home Page:http://nglviewer.org/nglview/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nv.write_html doesn't show any molecule.

mmmekr opened this issue · comments

my ver
OS: linux
picC

Hi all.

I created a conda env with python 3.11, and installed nglview with pip.
With the environment, I can see molecule in notebook, but I cannot see any molecules in html files.
picA

The html file said that
picB

I tryied an environment with python 3.9,
installing with conda,
jupyter-nbextension enable --py --user widgetsnbextension,
jupyter-nbextension enable --py --user nglview (both ok),
rm -rf ~/anaconda3/envs/test/share/jupyter/nbextensions/nglview-js-widgets/
conda install -c javascript nodejs,
cd js + npm install .

Thank you for your report. I've noted.

@hainm
OK, thanks for your reply.
So, could I solve this problem with an older version?
I actually tried the old one (nglview==2.7.1 and ipywidgets==5.7.1), but it didn't work.
If you have any ideas, please let me know.

hi @mmmekr I don't know the reason. It worked before (But I admitted I didn't test thing extensively).

dear @mmmekr I could not reproduce the issue on my macbook, chrome + python 3.10

image

The html shows the structure when I open it

@hainm
Thanks!!
When I created an environment with notebook==7.0.6, it could create a valid html file!!!
pica
(html file)
picb

However, when I tried an another code to show my AF2 predectied PDB files, It didn't create good html files.
pic

I tried rm -rf ~/anaconda3/envs/(envs)/share/jupyter/nbextensions/nglview-js-widgets, jupyter-nbextension enable --py --user widgetsnbextension, and jupyter-nbextension enable --py --user nglview, but It didn't work.

When I use an environment with notebook==6.5.4, It showed valid views but created invalid html files.
picc
picd

Dear @mmmekr : can you please try nv.show_structure_file instead? show_structure_file will read the content of pdb into string and will be saved in the html file. Let me know if that works.

@hainm, Thanks you for your advice!
It has worked!
I really appreciate you.

great. You're welcome, @mmmekr

Hai