3b1b / manim

Animation engine for explanatory math videos
MIT License
60.94k stars 5.72k forks source link

ImportError when running Manim example #2035

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the error

I'm a beginner in python and manim. I finished installing manim, then I met a problem running the circle example here Quickstart It repeats error and no results, how can I solve it?

Thanks in advance!

Code and Error

Code:

(base) zdf:~ zdf$ cd ./desktop/project
(base) zdf:project zdf$ manim -pql scene.py CreateCircle

Error:

Traceback (most recent call last):
  File "/Users/zdf/opt/anaconda3/bin/manim", line 5, in <module>
    from manim.__main__ import main
  File "/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/manim/__init__.py", line 26, in <module>
    from .animation.composition import *
  File "/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/manim/animation/composition.py", line 16, in <module>
    from ..scene.scene import Scene
  File "/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/manim/scene/scene.py", line 38, in <module>
    from ..camera.camera import Camera
  File "/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/manim/camera/camera.py", line 16, in <module>
    import cairo
  File "/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/cairo/__init__.py", line 1, in <module>
    from ._cairo import *  # noqa: F401,F403
ImportError: dlopen(/Users/zdf/opt/anaconda3/lib/python3.9/site-packages/cairo/_cairo.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_cairo_append_path)

Environment

OS System: MacOS manim version: 0.17.3 python version: 3.10.4

mikolajlubiak commented 11 months ago

This issue seems to be the same as this: https://github.com/Automattic/node-canvas/issues/2192 Try to apply this fixes: https://github.com/Automattic/node-canvas/issues/2192#issuecomment-1499520296 You can also search for answers in this issue: https://github.com/pygobject/pycairo/issues/226

nathancarter commented 7 months ago

The solution in those links did not work for me, but the solution here did: https://docs.manim.community/en/latest/faq/installation.html#i-am-using-anaconda-and-get-an-importerror-mentioning-that-some-symbol-is-not-found