Manim-Notebook / manim-notebook

Simple commands to replicate the manim dev workflow in VSCode
MIT License
5 stars 0 forks source link

some "Preview Manim Cell" execute but progress bar hangs (MacOS) #52

Closed VladimirFokow closed 1 day ago

VladimirFokow commented 4 days ago

Example:

from manimlib import *

class SquareToCircle(Scene):
    def construct(self):
        # 
        ## Set up
        circle = Circle()
        circle.set_fill(BLUE, opacity=0.5)
        circle.set_stroke(BLUE_E, width=4)
        square = Square()

        ## Cell
        self.play(ShowCreation(square), run_time=3)
        self.play(ReplacementTransform(square, circle))
        self.wait()

Hangs:

Screenshot 2024-10-28 at 22 28 13



It doesn't matter where you start the scene.

The problem is: "Preview Manim Cell" just always hangs.. - for the First cell only. (2nd cell works!!)

What solved it: pressing "Enter" in the terminal.



Hypothesis of what could be the reason:

is execution triggered by progress bars?



@Splines reproducible on linux?

Splines commented 4 days ago

Mmh, ok that's weird, for me it works just fine even for the first scene.

https://github.com/user-attachments/assets/8ada6b3b-5c41-4457-82ba-ae6b7df7852a

You know what: this is now a good time to introduce some logging to the extension (not just debugging console, but a proper file). This way, for future issues, we can ask users to send us the log, otherwise issues like these are really hard to debug as I don't have any MacOS system.

bhoov commented 4 days ago

I can confirm with @VladimirFokow the hanging on MacOS. Must fix for v0.1.0. Good find!

VladimirFokow commented 3 days ago

looks like the commands DO execute, BUT just: the "Previewing Manim" info box doesn't go away until the user presses Enter


Interestingly:

If we do NOT have sleep -

if we HAVE sleep



outdated (click to expand) Play around: ```py from manimlib import * import time class SquareToCircle(Scene): def construct(self): # ## Test print('1') # time.sleep(1) print('2') ```
Logs (click to expand)
Here I ran ## Test, it printed 1 and 2 immediately, but was showing a progress bar indefinitely, (the first 2 blocks of logs were created) I waited for a bit, then pressed Enter in the terminal (the 3rd block of logs was created). ``` 2024-10-29 14:37:03.099 [info] [extension.ts:17:11] [unknown] ๐Ÿ’  Command requested: Preview Manim Cell, startLine=6 2024-10-29 14:37:03.119 [debug] [manimShell.ts:232:16] [unknown] ๐Ÿš€ Exec command: checkpoint_paste(), waitUntilFinished=true, forceExecute=false, errorOnNoActiveShell=false 2024-10-29 14:37:03.119 [debug] [manimShell.ts:265:16] [unknown] ๐Ÿ”’ Command execution locked 2024-10-29 14:37:03.119 [debug] [manimShell.ts:451:20] [unknown] ๐Ÿ” Active shell already there 2024-10-29 14:37:03.120 [debug] [manimShell.ts:421:16] [unknown] ๐Ÿ”’ Shell execution end detection disabled 2024-10-29 14:37:03.120 [debug] [manimShell.ts:424:20] [unknown] ๐Ÿ’จ Sending command to terminal (with shell integration): checkpoint_paste() 2024-10-29 14:37:03.120 [debug] [manimShell.ts:432:16] [unknown] ๐Ÿ”“ Shell execution end detection re-enabled 2024-10-29 14:37:03.120 [debug] [previewCode.ts:38:24] [unknown] ๐Ÿ“Š Command issued: checkpoint_paste(). Will restore clipboard 2024-10-29 14:37:03.120 [debug] [manimShell.ts:290:20] [unknown] ๐Ÿ•’ Waiting until command has finished: checkpoint_paste() 2024-10-29 14:37:03.193 [trace] [manimShell.ts:514:28] [unknown] ๐Ÿงพ Terminal data: 2024-10-29 14:37:03.326 [trace] [manimShell.ts:514:28] [unknown] ๐Ÿงพ Terminal data: In [3]: checkpoint_paste()In [3]: checkpoint_paste() 1 2 In [4]: In [4]:  2024-10-29 14:37:03.326 [debug] [manimShell.ts:536:32] [unknown] ๐Ÿ“ฆ IPython cell 3 detected 2024-10-29 14:37:03.326 [debug] [manimShell.ts:475:24] [unknown] ๐Ÿ•’ While waiting for command to finish, iPythonCellCount=3, currentExecutionCount=3 2024-10-29 14:37:03.326 [debug] [manimShell.ts:475:24] [unknown] ๐Ÿ•’ While waiting for command to finish, iPythonCellCount=3, currentExecutionCount=3 2024-10-29 14:37:23.811 [trace] [manimShell.ts:514:28] [unknown] ๐Ÿงพ Terminal data: In [4]: In [4]: In [4]:  2024-10-29 14:37:23.811 [debug] [manimShell.ts:536:32] [unknown] ๐Ÿ“ฆ IPython cell 4 detected 2024-10-29 14:37:23.811 [debug] [manimShell.ts:475:24] [unknown] ๐Ÿ•’ While waiting for command to finish, iPythonCellCount=4, currentExecutionCount=3 2024-10-29 14:37:23.811 [debug] [manimShell.ts:479:28] [unknown] ๐Ÿ•’ Command has finished 2024-10-29 14:37:23.811 [debug] [manimShell.ts:475:24] [unknown] ๐Ÿ•’ While waiting for command to finish, iPythonCellCount=4, currentExecutionCount=3 2024-10-29 14:37:23.811 [debug] [manimShell.ts:479:28] [unknown] ๐Ÿ•’ Command has finished 2024-10-29 14:37:23.811 [debug] [manimShell.ts:487:20] [unknown] ๐Ÿ•’ Calling callback after command has finished 2024-10-29 14:37:23.811 [debug] [manimShell.ts:285:20] [unknown] ๐Ÿ”“ Command execution unlocked 2024-10-29 14:37:23.811 [debug] [manimShell.ts:292:20] [unknown] ๐Ÿ•’ Command has finished: checkpoint_paste() 2024-10-29 14:37:23.811 [debug] [previewCode.ts:139:16] [unknown] ๐Ÿ“Š Finishing progress notification ```


VladimirFokow commented 2 days ago

Log 1:

Manim Notebook.log

To show that:

Code:

from manimlib import *
import time

class SquareToCircle(Scene):
    def construct(self):
        #
        ## Test
        print('1')
        # time.sleep(1)
        print('2')

Steps:

VladimirFokow commented 2 days ago

Log 2:

Manim Notebook.log

To show that:

Code:

same as above (version 1)

Steps:

VladimirFokow commented 2 days ago

Log 3:

Manim Notebook.log

To show that:

Code:

uncommented sleep:

from manimlib import *
import time

class SquareToCircle(Scene):
    def construct(self):
        #
        ## Test
        print('1')
        time.sleep(1)
        print('2')

Steps:

VladimirFokow commented 2 days ago

Log 4:

Manim Notebook.log

To show that:

Code:

same as version 1

from manimlib import *
import time

class SquareToCircle(Scene):
    def construct(self):
        #
        ## Test
        print('1')
        # time.sleep(1)
        print('2')

Steps:

VladimirFokow commented 2 days ago

hm.. considering this looks very weird, @Splines I certainly don't expect you to solve this without even having a MacOS system.

I would be able to see how your ManimShell class works in the coming 1-2 months, and then debug this from the ground up