简体   繁体   中英

How can I install manim on macos?

I'm trying to install manim on mac, however I'm clueless as how the terminal and everything works, I'm just following tutorials anf copy/pasting stuff in the console. I'm doing pip install manimlib on the terminal, which should install the package, but I get the following error :

Building wheels for collected packages: pycairo
  Building wheel for pycairo (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/anaconda3/bin/python /opt/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/d7/5ck284fd7t9130wpwl62rkwh0000gn/T/tmpmazoiavw
       cwd: /private/var/folders/d7/5ck284fd7t9130wpwl62rkwh0000gn/T/pip-install-ip_5iqrw/pycairo_705073eb1a214eec8f3c3913abe5de7f
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.7
  creating build/lib.macosx-10.9-x86_64-3.7/cairo
  copying cairo/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/cairo
  copying cairo/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.7/cairo
  copying cairo/py.typed -> build/lib.macosx-10.9-x86_64-3.7/cairo
  running build_ext
  Requested 'cairo >= 1.15.10' but version of cairo is 1.14.12
  Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly

I tried reading some question on stack overflow but none of the answers seemed to work for me. I understand nothing about what is written here, what should I write in my console to be able to install manim properly ? Thanks in advance guys :)

I don't know much about Manim, but I'm pretty familiar with the error message you're currently getting because it's related to a project I'm working on myself.

The reason your install isn't working is because the Manim library has several dependencies that have to be installed in order for it to work properly (at least according to the documentation on their website ). One of these dependencies is Pycairo, which is a Python interface for Cairo, a vector graphics library written in C. My guess would be that Pycairo does the heavy lifting when it comes to drawing things in Manim.

Whenever you run a pip installation, the built-in package manager will read all of the dependencies that the package you're trying to install has, and it will install those packages as well. That's what pip is doing right now with Pycairo. However, unfortunately with MacOS, the Cairo binary files (ie the code compiled from C that allows Pycairo to run properly) are not included in the pip installation like it is with some other operating systems like Windows, so it causes this error message you're seeing. This issue with MacOS is actually what brought me to your post.

To fix the issue, you'll need to install Cairo manually using something called Homebrew, which is a useful package manager that lets you install packages right from the Mac terminal. The instructions for how to install Homebrew, as well as how to install Cairo and some other Manim dependencies via Homebrew, are included in that documentation page I linked above.

After you do all that, you should be able to run this pip installation again and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM