3b1b / manim

Animation engine for explanatory math videos
MIT License
67.14k stars 6.02k forks source link

Error when running the example_scenes.py file after installation #512

Open gauthamrdy opened 5 years ago

gauthamrdy commented 5 years ago

I'm facing the following error when I run the example file as suggested in the documentation. I am unable to understand the error here.

~/manim$ python -m manim example_scenes.py -pl
Media will be stored in media/. You can change this behavior by writing a different directory to media_dir.txt.
Traceback (most recent call last):
  File "/home/gautham/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/gautham/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/gautham/manim/manim.py", line 3, in <module>
    import manimlib.extract_scene
  File "/home/gautham/manim/manimlib/extract_scene.py", line 9, in <module>
    from manimlib.scene.scene import Scene
  File "/home/gautham/manim/manimlib/scene/scene.py", line 11, in <module>
    from manimlib.camera.camera import Camera
  File "/home/gautham/manim/manimlib/camera/camera.py", line 9, in <module>
    import cairo
  File "/home/gautham/anaconda3/lib/python3.6/site-packages/cairo/__init__.py", line 1, in <module>
    from ._cairo import *  # noqa: F401,F403
ImportError: /home/gautham/anaconda3/lib/python3.6/site-packages/cairo/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index
Elteoremadebeethoven commented 5 years ago

Install python 3.7, then install pip here and the requirements again.

JusticeBoi commented 5 years ago

Install python 3.7, then install pip here and the requirements again.

I have the exact problem. I created a virtualenv and installed pip like you suggested but still get the same error. I'm running on ubuntu 16.04

ImportError: /home/oguz/softwares/manim/venv/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index

This is what i get.

Kolloom commented 5 years ago
ldd lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so 
    libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ffbdffc7000)

pycairo depends on libcairo2, make sure you have that installed too.

JusticeBoi commented 5 years ago
ldd lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so 
  libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ffbdffc7000)

pycairo depends on libcairo2, make sure you have that installed too.

Good point, the libcairo.so.2 that my _cairo.cpython-37m-x86_64-linux-gnu.so depends on is libcairo.so.2 -> libcairo.so.2.11400.12. Maybe this linked libcairo.so.2.11400.12 is the wrong version somehow?

I did sudo apt install libcairo2 libcairo2-dev already and it says its the newest version.

Kolloom commented 5 years ago

Unlikely. The general version links to the specific one.

ls -l /usr/lib/x86_64-linux-gnu/libcairo*
-rw-r--r-- 1 root root 2265478 Mar 15 02:57 /usr/lib/x86_64-linux-gnu/libcairo.a
-rw-r--r-- 1 root root   46074 Mar 15 02:57 /usr/lib/x86_64-linux-gnu/libcairo-gobject.a
lrwxrwxrwx 1 root root      29 Mar 15 02:57 /usr/lib/x86_64-linux-gnu/libcairo-gobject.so -> libcairo-gobject.so.2.11600.0
lrwxrwxrwx 1 root root      29 Mar 15 02:57 /usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2 -> libcairo-gobject.so.2.11600.0
-rw-r--r-- 1 root root   42768 Mar 15 02:57 /usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2.11600.0

Make sure you satisfy those dependencies.

Pycairo is a Python module providing bindings for the cairo graphics library. It depends on cairo >= 1.13.1 and works with Python 2.7+ as well as Python 3.5+. Pycairo, including this documentation, is licensed under the LGPLv2.1 as well as the MPLv1.1.

I don't know if anaconda fix their pycairo packages yet. https://github.com/pygobject/pycairo/issues/105

Lasty see if reinstalling pycairo via pip fix that.

JusticeBoi commented 5 years ago

Hey, thank you for referencing other issues similar to mine, as removing anaconda and using system python3.6 to create virtualenv worked out. Hope this also helps @gautham949's problem. #637 helped me out. Cheers!

ghost commented 2 years ago

Hi, I had this same issue and although python 3.6 did solve it I found that it breaks some methods in the Manim Library as it only supports version 0.6.0 and not the current (or future) one.

I managed to get it working nicely using python 3.9, using 3.7 or 3.8 did not work for me.

I hope this comment helps out.