3b1b/manim

Installing on MacOS - A Series of Missing Modules

zhiangseanwang opened this issue · 9 comments

I am trying to install ManimGL after watching the latest 3B1B video.
I am on a M3 Macbook Pro.

I ran pip3 install manimgl which worked.

Then I tried the manimgl example_scenes.py OpeningManimExample command which was supposed to render a scene.

Instead an error showed up that read:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/bin/manimgl", line 5, in <module>
    from manimlib.__main__ import main
  File "/Users/Sean/manim/manimlib/__init__.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

I attempted to resolve this by installing setuptools separately, using pip3 install setuptools
Then I ran the same manimgl command again but met another error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/bin/manimgl", line 5, in <module>
    from manimlib.__main__ import main
  File "/Users/Sean/manim/manimlib/__init__.py", line 14, in <module>
    from manimlib.animation.animation import *
  File "/Users/Sean/manim/manimlib/animation/animation.py", line 5, in <module>
    from manimlib.mobject.mobject import _AnimationBuilder
  File "/Users/Sean/manim/manimlib/mobject/mobject.py", line 27, in <module>
    from manimlib.utils.color import color_gradient
  File "/Users/Sean/manim/manimlib/utils/color.py", line 11, in <module>
    from manimlib.utils.bezier import interpolate
  File "/Users/Sean/manim/manimlib/utils/bezier.py", line 9, in <module>
    from manimlib.utils.space_ops import cross2d
  File "/Users/Sean/manim/manimlib/utils/space_ops.py", line 8, in <module>
    from mapbox_earcut import triangulate_float32 as earcut
ModuleNotFoundError: No module named 'mapbox_earcut'

I then tried pip3 install mapbox-earcut but got this:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydub/utils.py", line 14, in <module>
    import audioop
ModuleNotFoundError: No module named 'audioop'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/bin/manimgl", line 5, in <module>
    from manimlib.__main__ import main
  File "/Users/Sean/manim/manimlib/__init__.py", line 60, in <module>
    from manimlib.scene.interactive_scene import *
  File "/Users/Sean/manim/manimlib/scene/interactive_scene.py", line 28, in <module>
    from manimlib.scene.scene import Scene
  File "/Users/Sean/manim/manimlib/scene/scene.py", line 40, in <module>
    from manimlib.scene.scene_file_writer import SceneFileWriter
  File "/Users/Sean/manim/manimlib/scene/scene_file_writer.py", line 10, in <module>
    from pydub import AudioSegment
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydub/__init__.py", line 1, in <module>
    from .audio_segment import AudioSegment
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydub/audio_segment.py", line 11, in <module>
    from .utils import mediainfo_json, fsdecode
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydub/utils.py", line 16, in <module>
    import pyaudioop as audioop
ModuleNotFoundError: No module named 'pyaudioop'

At this point I can't manually install anything extra, so I am stuck.

Has this issue happened to anyone else? I would really appreciate your help! Thanks in advance.

This is because ManimGL 1.7.0 has not yet been released on PyPI. The version you are downloading through pip, is very old and doesn't support new versions of Python. For now, you can download the repository and install ManimGL from the repository itself by running pip install . in the repository folder. You don't need to fork the repository.

@3b1b It would be great to update the actual PyPI package to version 1.7.0, so people don't have problems downloading ManimGL through PyPI. This will close many issues related to 1.6.1.

3b1b commented

I just updated it on PyPI. Does the newer version work for you?

It works perfectly. Thank you very much!

Do you want me to compile a list of issues that are based on errors when starting the 1.6.1 version of Manim in newer Python environments? Now that the PyPI package has been updated, we can just notify the issue authors and close them. In case someone reopens them, we would be happy to investigate further.

3b1b commented

Sure, that'd be very helpful. Thanks!

I've tested the PyPI release in a sandbox, it works, but there's one dependency that is not in the package list and is not installed by pip when installing manimgl. We have to add mapbox_earcut in the dependencies here. Compare the dependencies with the requirements.txt.

List of issues related to running ManimGL 1.6.1 in newer Python versions

Many libraries, such as numpy are not backwards compatible. So, when running newer versions of Python, pip installs newer packages. Particularly numpy after 1.24 made some changes that broke ManimGL 1.6.1 (when Manim was comparing some set of points, there was a dimensionality mismatch of arrays, this is not allowed anymore in the newer numpy versions. It throws an error). At the same time, numpy<=1.24 cannot be installed on newer Python versions.

  • Well known numpy API breakage when running in ManimGL 1.6.1 in Python 3.12 or later: #2162
  • Same numpy issue: #2053
  • Same numpy issue: #2050
  • Using very old numpy version (version mismatch): #2032
  • Install fail on Windows, not enough info: #2011
  • known ManimPango issue, where it doesn't compile on newer pip, the guy was installing manimgl through pypi on Python 3.11.2: #1998
  • This is even older ManimGL version, but reported as 1.6.1, I'm not really sure... #1823
  • Discussion on the manimlib version error: #2098
  • Already answered: #2182
  • Loading issue with example_scenes, probably using 1.6.1: #2150
3b1b commented

I see, I just added that. What's the simplest way to add that dependency, it feels a little silly to add a whole new release (as you can tell, this is unfamiliar territory for me).

Unfortunately, there's no way to update the PyPI package without releasing a new one. Just bumping the minor version from 1.7.0 to 1.7.1 is totally fine. In fact, this is not silly, more frequent releases are recommended if the API doesn't break. This way we provide the latest bug fixes to newcomers and to old users as well. If you believe that just bumping this dependency is not worth it, I suggest waiting for a few more bug fixes and maybe giving me some time to test a few more critical things that need fixing. I have trouble with the -p command in the master branch. Because I was working with -se, I didn't even notice problems with -p.