Union operation in Manim causes Skia fatal error on macOS 14.5 with Apple M2 Pro
Description of bug / unexpected behavior
When trying to create a union of a square and a circle using Manim, the script crashes with a fatal error related to the Skia library. The error message is:
../../../../../../src/cpp/skia-builder/skia/src/base/SkContainers.cpp:106: fatal error: "Requested capacity is too large."
Expected behavior
The script should create and display the union of the square and circle without crashing.
How to reproduce the issue
The issue can be reproduced with the following code:
Code for reproducing the problem
from manim import *
class UnionExample(Scene):
def construct(self):
sq = Square(color=RED, fill_opacity=1)
sq.move_to([-2, 0, 0])
cr = Circle(color=BLUE, fill_opacity=1)
cr.move_to([-1.3, 0.7, 0])
un = Union(sq, cr, color=GREEN, fill_opacity=1)
un.move_to([1.5, 0.3, 0])
self.add(sq, cr, un)
Additional media files
No additional media files were generated due to the crash.
Logs
Terminal output
Manim Community v0.18.1
../../../../../../src/cpp/skia-builder/skia/src/base/SkContainers.cpp:106: fatal error: "Requested capacity is too large."
[1] 77190 trace trap
System specifications
System Details
- OS: macOS 14.5 (Sonoma)
- Device: MacBook Pro 14 (2023 model)
- Chip: Apple M2 Pro
- RAM: 32 GB
- Python version: Python 3.12.2 (conda environment)
- Installed modules:
# packages in environment at /opt/miniconda3/envs/study:
#
# Name Version Build Channel
aom 3.6.1 hb765f3a_0 conda-forge
blas 1.0 openblas
brotli 1.0.9 h80987f9_8
brotli-bin 1.0.9 h80987f9_8
brotli-python 1.0.9 py312h313beb8_8
bzip2 1.0.8 h80987f9_6
ca-certificates 2024.6.2 hf0a4a13_0 conda-forge
cachecontrol 0.14.0 pyhd8ed1ab_0 conda-forge
cachecontrol-with-filecache 0.14.0 pyhd8ed1ab_0 conda-forge
cairo 1.18.0 hd1e100b_0 conda-forge
certifi 2024.6.2 py312hca03da5_0
cffi 1.16.0 py312h8e38eb3_0 conda-forge
charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge
cleo 2.1.0 pyhd8ed1ab_0 conda-forge
click 8.1.7 unix_pyh707e725_0 conda-forge
click-default-group 1.2.4 pyhd8ed1ab_0 conda-forge
cloup 3.0.5 pyhd8ed1ab_0 conda-forge
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
contourpy 1.2.0 py312h48ca7d4_0
crashtest 0.4.1 pyhd8ed1ab_0 conda-forge
cycler 0.11.0 pyhd3eb1b0_0
cython 3.0.10 py312h20a0b95_0 conda-forge
dav1d 1.2.1 hb547adb_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
distlib 0.3.8 pyhd8ed1ab_0 conda-forge
dulwich 0.21.7 py312he37b823_0 conda-forge
expat 2.6.2 h313beb8_0
ffmpeg 5.1.2 gpl_h9861f02_112 conda-forge
filelock 3.14.0 pyhd8ed1ab_0 conda-forge
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3.000 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 h77eed37_2 conda-forge
fontconfig 2.14.2 h82840c6_0 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 0 conda-forge
fonttools 4.51.0 py312h80987f9_0
freetype 2.12.1 h1192e45_0
fribidi 1.0.10 h27ca646_0 conda-forge
future 1.0.0 pyhd8ed1ab_0 conda-forge
gettext 0.22.5 h8fbad5d_2 conda-forge
gettext-tools 0.22.5 h8fbad5d_2 conda-forge
glcontext 2.5.0 py312h650e478_0 conda-forge
glib 2.80.2 h535f939_0 conda-forge
glib-tools 2.80.2 h4c882b9_0 conda-forge
gmp 6.3.0 hebf3989_1 conda-forge
gnutls 3.7.9 hd26332c_0 conda-forge
graphite2 1.3.13 hebf3989_1003 conda-forge
harfbuzz 8.5.0 h1836168_0 conda-forge
icu 73.2 hc8870d7_0 conda-forge
idna 3.7 pyhd8ed1ab_0 conda-forge
importlib-metadata 7.1.0 pyha770c72_0 conda-forge
isosurfaces 0.1.2 pyhd8ed1ab_0 conda-forge
jaraco.classes 3.4.0 pyhd8ed1ab_1 conda-forge
jpeg 9e h80987f9_1
keyring 24.3.1 py312h81bd7bf_0 conda-forge
kiwisolver 1.4.4 py312h313beb8_0
lame 3.100 h1a8c8d9_1003 conda-forge
lcms2 2.12 hba8e193_0
lerc 3.0 hc377ac9_0
libasprintf 0.22.5 h8fbad5d_2 conda-forge
libasprintf-devel 0.22.5 h8fbad5d_2 conda-forge
libass 0.17.1 hf7da4fe_1 conda-forge
libbrotlicommon 1.0.9 h80987f9_8
libbrotlidec 1.0.9 h80987f9_8
libbrotlienc 1.0.9 h80987f9_8
libcxx 17.0.6 h5f092b4_0 conda-forge
libdeflate 1.17 h80987f9_1
libexpat 2.6.2 hebf3989_0 conda-forge
libffi 3.4.4 hca03da5_1
libgettextpo 0.22.5 h8fbad5d_2 conda-forge
libgettextpo-devel 0.22.5 h8fbad5d_2 conda-forge
libgfortran 5.0.0 11_3_0_hca03da5_28
libgfortran5 11.3.0 h009349e_28
libglib 2.80.2 h535f939_0 conda-forge
libiconv 1.17 h0d3ecfb_2 conda-forge
libidn2 2.3.7 h93a5062_0 conda-forge
libintl 0.22.5 h8fbad5d_2 conda-forge
libintl-devel 0.22.5 h8fbad5d_2 conda-forge
libopenblas 0.3.21 h269037a_0
libopus 1.3.1 h27ca646_1 conda-forge
libpng 1.6.39 h80987f9_0
libsqlite 3.45.3 h091b4b1_0 conda-forge
libtasn1 4.19.0 h1a8c8d9_0 conda-forge
libtiff 4.5.1 h313beb8_0
libunistring 0.9.10 h3422bc3_0 conda-forge
libvpx 1.13.1 hb765f3a_0 conda-forge
libwebp-base 1.3.2 h80987f9_0
libxml2 2.12.7 ha661575_1 conda-forge
libzlib 1.2.13 hfb2fe0b_6 conda-forge
llvm-openmp 14.0.6 hc6e5704_0
lz4-c 1.9.4 h313beb8_1
manim 0.18.1 pyhd8ed1ab_0 conda-forge
manimpango 0.5.0 py312h10c113c_0 conda-forge
mapbox_earcut 1.0.1 py312h389731b_0 conda-forge
markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge
matplotlib 3.8.4 py312hca03da5_0
matplotlib-base 3.8.4 py312hd77ebd4_0
mdurl 0.1.2 pyhd8ed1ab_0 conda-forge
moderngl 5.10.0 py312h8ae5369_1 conda-forge
moderngl-window 2.4.1 pyhd8ed1ab_0 conda-forge
more-itertools 10.2.0 pyhd8ed1ab_0 conda-forge
msgpack-python 1.0.8 py312h157fec4_0 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
ncurses 6.4 h313beb8_0
nettle 3.9.1 h40ed0f5_0 conda-forge
networkx 3.3 pyhd8ed1ab_1 conda-forge
numpy 1.26.4 py312h7f4fdc5_0
numpy-base 1.26.4 py312he047099_0
openh264 2.3.1 hb7217d7_2 conda-forge
openjpeg 2.3.0 h7a6adac_2
openssl 3.3.1 hfb2fe0b_0 conda-forge
p11-kit 0.24.1 h29577a5_0 conda-forge
packaging 23.2 py312hca03da5_0
pango 1.50.14 hcf40dda_2 conda-forge
pcre2 10.43 h26f9a81_0 conda-forge
pexpect 4.9.0 pyhd8ed1ab_0 conda-forge
pillow 10.3.0 py312h80987f9_0
pip 24.0 py312hca03da5_0
pixman 0.43.4 hebf3989_0 conda-forge
pkginfo 1.11.0 pyhd8ed1ab_0 conda-forge
platformdirs 4.2.2 pyhd8ed1ab_0 conda-forge
poetry 1.8.3 osx_pyh534df25_1 conda-forge
poetry-core 1.9.0 pyhd8ed1ab_0 conda-forge
poetry-plugin-export 1.8.0 pyhd8ed1ab_0 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pybind11-abi 5 hd3eb1b0_0
pycairo 1.26.0 py312h6cb0442_0 conda-forge
pycparser 2.22 pyhd8ed1ab_0 conda-forge
pydub 0.25.1 pyhd8ed1ab_0 conda-forge
pyglet 1.5.27 py312h81bd7bf_4 conda-forge
pygments 2.18.0 pyhd8ed1ab_0 conda-forge
pyobjc-core 10.2 py312h9d22092_0 conda-forge
pyobjc-framework-cocoa 10.2 py312h9d22092_0 conda-forge
pyparsing 3.0.9 py312hca03da5_0
pyproject_hooks 1.1.0 pyhd8ed1ab_0 conda-forge
pyrr 0.10.3 py_0 conda-forge
pysocks 1.7.1 pyha2e5f31_6 conda-forge
python 3.12.2 hdf0ec26_0_cpython conda-forge
python-build 1.2.1 pyhd8ed1ab_0 conda-forge
python-dateutil 2.9.0post0 py312hca03da5_0
python-fastjsonschema 2.19.1 pyhd8ed1ab_0 conda-forge
python-installer 0.7.0 pyhd8ed1ab_0 conda-forge
python_abi 3.12 4_cp312 conda-forge
pyyaml 6.0.1 py312h02f2b3b_1 conda-forge
rapidfuzz 3.9.3 py312h5c2e7bc_0 conda-forge
readline 8.2 h1a28f6b_0
requests 2.32.3 pyhd8ed1ab_0 conda-forge
requests-toolbelt 1.0.0 pyhd8ed1ab_0 conda-forge
rich 13.7.1 pyhd8ed1ab_0 conda-forge
scipy 1.13.1 py312ha409365_0
screeninfo 0.8.1 py312h81bd7bf_2 conda-forge
setuptools 69.5.1 py312hca03da5_0
shellingham 1.5.4 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyhd3eb1b0_1
skia-pathops 0.8.0.post1 py312h76e736e_2 conda-forge
sqlite 3.45.3 h80987f9_0
srt 3.5.3 py312h81bd7bf_0 conda-forge
svgelements 1.9.6 pyhd8ed1ab_0 conda-forge
svt-av1 1.4.1 h7ea286d_0 conda-forge
tk 8.6.14 h6ba3021_0
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
tomlkit 0.12.5 pyha770c72_0 conda-forge
tornado 6.3.3 py312h80987f9_0
tqdm 4.66.4 pyhd8ed1ab_0 conda-forge
trove-classifiers 2024.5.22 pyhd8ed1ab_0 conda-forge
typing-extensions 4.12.2 hd8ed1ab_0 conda-forge
typing_extensions 4.12.2 pyha770c72_0 conda-forge
tzdata 2024a h04d1e81_0
unicodedata2 15.1.0 py312h80987f9_0
urllib3 2.2.1 pyhd8ed1ab_0 conda-forge
virtualenv 20.26.2 pyhd8ed1ab_0 conda-forge
watchdog 4.0.1 py312h7e5086c_0 conda-forge
wheel 0.43.0 py312hca03da5_0
x264 1!164.3095 h57fd34a_2 conda-forge
x265 3.5 hbc6ce65_3 conda-forge
xattr 1.1.0 py312he37b823_0 conda-forge
xz 5.4.6 h80987f9_1
yaml 0.2.5 h3422bc3_2 conda-forge
zipp 3.18.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.13 hfb2fe0b_6 conda-forge
zstd 1.5.5 hd90d995_2
LaTeX details
==> mactex-no-gui: 2024.0312
https://www.tug.org/mactex/
Installed
/opt/homebrew/Caskroom/mactex-no-gui/2024.0312 (5.6GB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/m/mactex-no-gui.rb
==> Name
MacTeX
==> Description
Full TeX Live distribution without GUI applications
==> Artifacts
mactex-20240312.pkg (Pkg)
==> Caveats
You must restart your terminal window for the installation of MacTeX CLI
tools to take effect.
Additional comments
This issue seems related to the memory allocation in the Skia library when performing complex shape operations. Simplifying the shapes or avoiding complex operations may be a temporary workaround, but a proper fix would be ideal.
Exactly the same has been reported before - and supposedly at least then, a re-installation of the skia package solved the problem:
https://github.com/ManimCommunity/manim/issues/3456
I tried re-installing the Skia package using the command conda install skia-pathops --force-reinstall, and it did not resolve the issue for me. The script still crashes with the same fatal error.
The issue is likely related to the Python version. I had the exact same problem on my Mac with Apple Silicon, and I was using the same Python version. The problem was resolved when I created a virtual environment with Python 3.10.16.