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$
Try with this
This don't work I'm tried to install again and have this mesaage
(base) Tests-MacBook-Pro:ManimInstall test$ brew install cairo
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
wtfutil
Warning: cairo 1.16.0_2 is already installed and up-to-date
To reinstall 1.16.0_2, run `brew reinstall cairo
but i try to run the code and have the same error
(base) Tests-MacBook-Pro:ManimInstall test$ python3 -m manim example_scenes.py -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/Documents/ManimInstall/manim.py", line 2, in <module>
import manimlib
File "/Users/daniellara/Documents/ManimInstall/manimlib/__init__.py", line 4, in <module>
import manimlib.extract_scene
File "/Users/daniellara/Documents/ManimInstall/manimlib/extract_scene.py", line 9, in <module>
from manimlib.scene.scene import Scene
File "/Users/daniellara/Documents/ManimInstall/manimlib/scene/scene.py", line 12, in <module>
from manimlib.camera.camera import Camera
File "/Users/daniellara/Documents/ManimInstall/manimlib/camera/camera.py", line 9, in <module>
import cairo
ModuleNotFoundError: No module named 'cairo'
I see what the error is, you are using a virtual environment (I guess it is virtualenv), in your first comment you were not using it.
First comment:
Tests-MacBook-Pro:ManimInstall test$ python3 -m manim example_scenes.py WriteStuff -pl
Second comment:
(base) Tests-MacBook-Pro:ManimInstall test$ python3 -m manim example_scenes.py -pl
If you are going to use a virtual environment you must reinstall all the python packages with pip. In your case:
(base) Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install -r requirements.txt
(base) Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install pyreadline
(base) Tests-MacBook-Pro:ManimInstall test$ python3 -m pip install pydub
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$
You forgot the 3 in python:
python3 -m manim ...
Oh! yes i looked this. It's my first time with Python but I uninstall all and try to reinstall again but the problem hold. A friend suggest me that this can be a problem with the path of the modules or something related but i don't kwno how solve this.
I tried again and have this
Tests-MacBook-Pro:manim-master test$ python3 -m manim example_scenes.py WarpSquare -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/Downloads/ManimInstall/manim-master/manim.py", line 2, in <module>
import manimlib
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/__init__.py", line 4, in <module>
import manimlib.extract_scene
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/extract_scene.py", line 9, in <module>
from manimlib.scene.scene import Scene
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 12, in <module>
from manimlib.camera.camera import Camera
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/camera/camera.py", line 9, in <module>
import cairo
ModuleNotFoundError: No module named 'cairo'
Tests-MacBook-Pro:manim-master 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
Well I'm using Visual Studio Code like a terminal

I tryng to solve this problem using
import cairocffi as cairo
but the problem holds
Try this, go to manimlib/camera/camera.py line 9 in your manim-master folder and replace that line with import cairocffi as cairo
I tried this but i have another problem
Tests-MacBook-Pro:manim-master test$ python3 -m manim example_scenes.py WarpSquare -pl
Media will be written to ./media/. You can change this behavior with the --media_dir flag.
Tests-MacBook-Pro:manim-master test$ python3 -m manim example_scenes.py WarpSquare -pl
Media will be written to ./media/. You can change this behavior with the --media_dir flag.
Traceback (most recent call last):
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 53, in __init__
self.construct()
File "example_scenes.py", line 94, in construct
square
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 406, in wrapper
func(self, *args, **kwargs)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 463, in play
self.progress_through_animations(animations)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 438, in progress_through_animations
self.update_frame(moving_mobjects, static_image)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 140, in update_frame
self.capture_mobjects_in_camera(mobjects, **kwargs)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/scene/scene.py", line 118, in capture_mobjects_in_camera
self.camera.capture_mobjects(mobjects, **kwargs)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/camera/camera.py", line 269, in capture_mobjects
func(batch, self.pixel_array)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/camera/camera.py", line 317, in display_multiple_vectorized_mobjects
self.display_multiple_non_background_colored_vmobjects(batch, pixel_array)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/camera/camera.py", line 320, in display_multiple_non_background_colored_vmobjects
ctx = self.get_cairo_context(pixel_array)
File "/Users/daniellara/Downloads/ManimInstall/manim-master/manimlib/camera/camera.py", line 293, in get_cairo_context
pw, ph
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairocffi/surfaces.py", line 715, in create_for_data
return cls(format, width, height, data, stride)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairocffi/surfaces.py", line 703, in __init__
% (length, stride * height))
ValueError: Got a 480 bytes buffer, needs at least 1639680.
and in problems window have this

I forgot to tell you that you had to install cairocffi, with pip:
brew install cairocffi cffi CairoSVG lxml
python3 -m pip install cairocffi
And reboot.
Also check this.
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!
Hi, Im tried to install in mi macbook pro computed with Windows 10 and i complete this but when i tried the example i have this error
C:\Users\57316\Documents\GitHub\manim>python -m example_scenes.py
Traceback (most recent call last):
File "C:\Users\57316AppData\Local\Continuum\anaconda3\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\57316AppData\Local\Continuum\anaconda3\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\57316\Documents\GitHub\manim\example_scenes.py", line 3, in
from manimlib.imports import *
File "C:\Users\57316\Documents\GitHub\manim\manimlib__init__.py", line 4, in
import manimlib.extract_scene
File "C:\Users\57316\Documents\GitHub\manim\manimlib\extract_scene.py", line 9, in
from manimlib.scene.scene import Scene
File "C:\Users\57316\Documents\GitHub\manim\manimlib\scene\scene.py", line 12, in
from manimlib.camera.camera import Camera
File "C:\Users\57316\Documents\GitHub\manim\manimlib\camera\camera.py", line 9, in
import cairo
ModuleNotFoundError: No module named 'cairo'
pip install pycairo
Collecting pycairo
Using cached https://files.pythonhosted.org/packages/e8/9d/c8be300fc6b1298559d37a071c3833b0b251e0fff334d2e4c408d5789162/pycairo-1.19.1.tar.gz
Building wheels for collected packages: pycairo
Building wheel for pycairo (setup.py) ... error
Complete output from command C:\Users\57316\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\57316\AppData\Local\Temp\pip-install-9b0fel7m\pycairo\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\57316\AppData\Local\Temp\pip-wheel-mhk6l4qx --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\cairo
copying cairo__init__.py -> build\lib.win-amd64-3.7\cairo
copying cairo__init__.pyi -> build\lib.win-amd64-3.7\cairo
copying cairo\py.typed -> build\lib.win-amd64-3.7\cairo
running build_ext
building 'cairo._cairo' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
Command "C:\Users\57316\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\57316\AppData\Local\Temp\pip-install-9b0fel7m\pycairo\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\57316\AppData\Local\Temp\pip-record-wvs_qfw6\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\57316\AppData\Local\Temp\pip-install-9b0fel7m\pycairo\
I faced the same error when installing pycario, do I have to install cairocffi first?
Most helpful comment
I faced the same error when installing pycario, do I have to install cairocffi first?