module 'cairo' has no attribute 'ImageSurface',
- Dominant language
- Python
- Stars
- 93.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
https://github.com/3b1b/manim/issues/420 did not work for me.
doing pip3 install pycairo gives me
----------------------------------------
Collecting pycairo
Using cached pycairo-1.19.1.tar.gz (205 kB)
Building wheels for collected packages: pycairo
Building wheel for pycairo (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/pycairo/setup.py'"'"'; __file__='"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/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 /private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-wheel-fynd3_xc
cwd: /private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/pycairo/
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.7
creating build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.15-x86_64-3.7/cairo
running build_ext
building 'cairo._cairo' extension
creating build/temp.macosx-10.15-x86_64-3.7
creating build/temp.macosx-10.15-x86_64-3.7/cairo
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=19 -DPYCAIRO_VERSION_MICRO=1 -I/usr/local/Cellar/libffi/3.3/include -I/usr/local/Cellar/cairo/1.16.0_3/include/cairo -I/usr/local/Cellar/glib/2.64.2_1/include -I/usr/local/Cellar/glib/2.64.2_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.64.2_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.44/include -I/usr/local/Cellar/pixman/0.40.0/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libpng/1.6.37/include/libpng16 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/include -I/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c cairo/device.c -o build/temp.macosx-10.15-x86_64-3.7/cairo/device.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
In file included from cairo/device.c:30:
/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include
^~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
ERROR: Command errored out with exit status 1:
command: /Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/pycairo/setup.py'"'"'; __file__='"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/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 /private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-record-8rz88fot/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/include/site/python3.7/pycairo
cwd: /private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/pycairo/
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.7
creating build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/__init__.pyi -> build/lib.macosx-10.15-x86_64-3.7/cairo
copying cairo/py.typed -> build/lib.macosx-10.15-x86_64-3.7/cairo
running build_ext
building 'cairo._cairo' extension
creating build/temp.macosx-10.15-x86_64-3.7
creating build/temp.macosx-10.15-x86_64-3.7/cairo
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=19 -DPYCAIRO_VERSION_MICRO=1 -I/usr/local/Cellar/libffi/3.3/include -I/usr/local/Cellar/cairo/1.16.0_3/include/cairo -I/usr/local/Cellar/glib/2.64.2_1/include -I/usr/local/Cellar/glib/2.64.2_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.64.2_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.44/include -I/usr/local/Cellar/pixman/0.40.0/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libpng/1.6.37/include/libpng16 -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/include -I/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c cairo/device.c -o build/temp.macosx-10.15-x86_64-3.7/cairo/device.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
In file included from cairo/device.c:30:
/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:25:10: fatal error: 'stdio.h' file not found
#include
^~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/pycairo/setup.py'"'"'; __file__='"'"'/private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-install-41920uhk/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 /private/var/folders/vd/2zxky__j4hqbtdwr991w81r40000gn/T/pip-record-8rz88fot/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/venv/include/site/python3.7/pycairo Check the logs for full command output.`
----------------------------------------
**Other advice I found online was to change path for libffi package, which also did not work.
So I installed py3cairo using brew, and now I get the error**
----------------------------------------
(venv) MacbookPro-2:manim-master yuvrajchaudhry$ python3 -m manim example_scenes.py SquareToCircle -pl
Media will be written to /Users/yuvrajchaudhry/Documents/. You can change this behavior with the --media_dir flag.
Traceback (most recent call last):
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 53, in __init__
self.construct()
File "example_scenes.py", line 83, in construct
self.play(ShowCreation(square))
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 406, in wrapper
func(self, *args, **kwargs)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 463, in play
self.progress_through_animations(animations)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 438, in progress_through_animations
self.update_frame(moving_mobjects, static_image)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 140, in update_frame
self.capture_mobjects_in_camera(mobjects, **kwargs)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/scene/scene.py", line 118, in capture_mobjects_in_camera
self.camera.capture_mobjects(mobjects, **kwargs)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/camera/camera.py", line 269, in capture_mobjects
func(batch, self.pixel_array)
File "/Users/yuvrajchaudhry/Documents/progs/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/yuvrajchaudhry/Documents/progs/manim-master/manimlib/camera/camera.py", line 320, in display_multiple_non_background_colored_vmobjects
ctx = self.get_cairo_context(pixel_array)
File "/Users/yuvrajchaudhry/Documents/progs/manim-master/manimlib/camera/camera.py", line 290, in get_cairo_context
surface = cairo.ImageSurface.create_for_data(
AttributeError: module 'cairo' has no attribute 'ImageSurface'
----------------------------------------
I've spent way too many hours just to try to get this to work, I'm usually too proud to ask for help. I wanted to give up but decided to post here as a Hail Mary or whatever.
Any help is very appreciated. :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.