manim: Problems with Cairo

Hi, Im tried to install in mi macbook pro computed with MacOS Mojave and i complete this but when i tried the example i have this error

Tests-MacBook-Pro:ManimInstall test$ python3 -m manim example_scenes.py WriteStuff -pl
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/daniellara/ManimInstall/manim.py", line 2, in <module>
    import manimlib
  File "/Users/daniellara/ManimInstall/manimlib/__init__.py", line 4, in <module>
    import manimlib.extract_scene
  File "/Users/daniellara/ManimInstall/manimlib/extract_scene.py", line 9, in <module>
    from manimlib.scene.scene import Scene
  File "/Users/daniellara/ManimInstall/manimlib/scene/scene.py", line 12, in <module>
    from manimlib.camera.camera import Camera
  File "/Users/daniellara/ManimInstall/manimlib/camera/camera.py", line 9, in <module>
    import cairo
ModuleNotFoundError: No module named 'cairo'
Tests-MacBook-Pro:ManimInstall test$ 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I faced the same error when installing pycario, do I have to install cairocffi first?

Hi! I solve this problem with this code

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/libffi/lib"

and install pycairo

pip install pycairo

Thanks for your help!

Yes, I’m using Visual Studio Code. I ran these codes and tried again and terminal showed this

(base) Tests-MacBook-Pro:ManimInstall test$ python -m manim example_scenes.py SquareToCircle -pl
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/daniellara/Documents/ManimInstall/manim.py", line 2, in <module>
    import manimlib
  File "manimlib/__init__.py", line 2, in <module>
    import manimlib.config
  File "manimlib/config.py", line 174
    print(f"Failed to render scene: {str(e)}")
                                            ^
SyntaxError: invalid syntax
(base) Tests-MacBook-Pro:ManimInstall test$ 

The problem is that I do not know if you are trying to install it in the main version of python or in a virtual environment, the last comment you are no longer in virtualenv:

Tests-MacBook-Pro:manim-master test$ python3 -m manim example_scenes.py WarpSquare -pl

You are no longer in the environment (base), as in the previous ones. If you want to install manim in the main version of python then install the pip packages again, BUT without the virtualenv:

Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install -r requirements.txt
Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install pyreadline
Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install pydub