nglviewer / nglview

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

Issue during rendering when using MovieMaker on NGLView #1102

Closed PieuvreRouge closed 7 months ago

PieuvreRouge commented 7 months ago

Hello,

I simply tried to reproduce a film from a page of MDAnalysis website in jupyterlab : "https://userguide.mdanalysis.org/stable/examples/analysis/volumetric/density_analysis.html#Analysing-the-density-of-water-around-the-protein"

import MDAnalysis as mda
from MDAnalysis.tests.datafiles import TPR, XTC
from MDAnalysis.analysis import density

import numpy as np
import matplotlib.pyplot as plt
import nglview as nv
%matplotlib inline

u = mda.Universe(TPR, XTC)
view1 = nv.show_mdanalysis(u)
view1.add_representation(
    'licorice',
    selection='resname SOL',
)
view1
from nglview.contrib.movie import MovieMaker
movie = MovieMaker(
    view1,
    step=4,  # keep every 4th step
    render_params={"factor": 3},  # average quality render
    output='density_analysis_images/density_analysis-view1.gif',
)
movie.make()

But after trying to do that, I have the following output : Rendering ... without any other indications or error codes. It sounds like it freezes

Here are the versions of the modules that I use : numpy 1.26.4 py312heda63a1_0 conda-forge nglview 3.0.8 pyh1da8cd4_0 conda-forge

I don't think my problem is very complicated to solve. I apologise if this problem has already been discussed elsewhere, but I haven't found a satisfactory answer.

Thank you for any help you can provide.

hainm commented 7 months ago

Dear @PieuvreRouge I think I see this issue before (recently) too. I will investigate (no timeline yet).

hainm commented 7 months ago

@PieuvreRouge please pip install nglview==3.1.2 (latest) and try again. Fixed in #1103.

qzchen2022 commented 7 months ago

Hi,

I encountered the same problem while try to create movie in jupyter lab, even if I have installed the new version. Here is my code environment:

view=nv.show_mdanalysis(u) movie = MovieMaker(view, fps=24, output='movie.gif', in_memory=True) movie.make()

nglview.version : 3.1.2 moviepy.version : 1.0.3 imageio.version : 2.34.0 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers

hainm commented 7 months ago

Hi

Can you please display the view first and run the movie making in different cell?

Hai

On Wed, Mar 6, 2024 at 1:28 AM qzchen2022 @.***> wrote:

Hi,

I encountered the same problem while try to create movie in jupyter lab, even if I have installed the new version. Here is my code environment:

view=nv.show_mdanalysis(u) movie = MovieMaker(view, fps=24, output='movie.gif', in_memory=True) movie.make()

nglview.version : 3.1.2 moviepy.version : 1.0.3 imageio.version : 2.34.0 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers

— Reply to this email directly, view it on GitHub https://github.com/nglviewer/nglview/issues/1102#issuecomment-1980171131, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB645M33TF4HOM3RQEDUFTYW2ZPJAVCNFSM6AAAAABD6EANSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBQGE3TCMJTGE . You are receiving this because you were assigned.Message ID: @.***>

qzchen2022 commented 7 months ago

It works, thank you!

hainm commented 7 months ago

cheers