manimcommunity / manimpango Goto Github PK
View Code? Open in Web Editor NEWBinding for Pango, to use with Manim.
Home Page: https://manimpango.manim.community
License: MIT License
Binding for Pango, to use with Manim.
Home Page: https://manimpango.manim.community
License: MIT License
In Manim Text class, if override the text2svg method use pycairo:
def text2svg(self):
# anti-aliasing
size = self.size * 10
lsh = self.lsh * 10
if self.font == '':
raise Exception("text font can not be empty")
# file_name as a writable file object
file_name = BytesIO()
surface = cairo.SVGSurface(file_name, 600, 400)
context = cairo.Context(surface)
context.set_font_size(size)
context.move_to(START_X, START_Y)
It can manipulate SVG in memory.
Here is the reference:
pycairo svgsurface
surface.c
I've just forked and modified ManimPango (See code here). Here's the main course:
def markup_to_svg(
markup_str: str,
file_name: str,
width: int = 1920,
height: int = 1080,
*, # keyword only arguments below
justify: bool = False,
indent: int = 0,
alignment: int = 0,
line_width: int = -1,
) -> str
I think such a function is enough to handle all the requirements, as partial configurations applied on the text string can be handled by adding <span>
tags. This function simutaneously deals with Text
and MarkupText
class.
I'm hesitating whether to go on to make a new repository ManimGLPango
, or create another branch inside ManimPango
. Now I'm trying making a release on PyPI, but am facing some problems. Considered that I'm not familiar with this kind of work, if someone of ManimCommunity could help me create a separate branch and release this special version, many thanks!
This is what I'm faced with. When I run py -m build
, a quite long error is raised:
$ py -m build
* Creating venv isolated environment...
* Installing packages in isolated environment... (Cython>=0.27, setuptools, wheel)
* Getting dependencies for sdist...
running egg_info
writing ManimGLPango.egg-info\PKG-INFO
writing dependency_links to ManimGLPango.egg-info\dependency_links.txt
writing top-level names to ManimGLPango.egg-info\top_level.txt
reading manifest file 'ManimGLPango.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs\_build'
adding license file 'LICENSE'
writing manifest file 'ManimGLPango.egg-info\SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing ManimGLPango.egg-info\PKG-INFO
writing dependency_links to ManimGLPango.egg-info\dependency_links.txt
writing top-level names to ManimGLPango.egg-info\top_level.txt
reading manifest file 'ManimGLPango.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs\_build'
adding license file 'LICENSE'
writing manifest file 'ManimGLPango.egg-info\SOURCES.txt'
running check
creating ManimGLPango-0.1.0
creating ManimGLPango-0.1.0\ManimGLPango.egg-info
creating ManimGLPango-0.1.0\docs
creating ManimGLPango-0.1.0\docs\_static
creating ManimGLPango-0.1.0\docs\_templates
creating ManimGLPango-0.1.0\docs\_templates\autosummary
creating ManimGLPango-0.1.0\manimglpango
creating ManimGLPango-0.1.0\tests
creating ManimGLPango-0.1.0\tests\fonts
copying files to ManimGLPango-0.1.0...
copying .coveragerc -> ManimGLPango-0.1.0
copying CODE_OF_CONDUCT.md -> ManimGLPango-0.1.0
copying LICENSE -> ManimGLPango-0.1.0
copying MANIFEST.in -> ManimGLPango-0.1.0
copying README.md -> ManimGLPango-0.1.0
copying pyproject.toml -> ManimGLPango-0.1.0
copying requirements-dev.txt -> ManimGLPango-0.1.0
copying setup.cfg -> ManimGLPango-0.1.0
copying setup.py -> ManimGLPango-0.1.0
copying ManimGLPango.egg-info\PKG-INFO -> ManimGLPango-0.1.0\ManimGLPango.egg-info
copying ManimGLPango.egg-info\SOURCES.txt -> ManimGLPango-0.1.0\ManimGLPango.egg-info
copying ManimGLPango.egg-info\dependency_links.txt -> ManimGLPango-0.1.0\ManimGLPango.egg-info
copying ManimGLPango.egg-info\not-zip-safe -> ManimGLPango-0.1.0\ManimGLPango.egg-info
copying ManimGLPango.egg-info\top_level.txt -> ManimGLPango-0.1.0\ManimGLPango.egg-info
copying docs\Makefile -> ManimGLPango-0.1.0\docs
copying docs\RELEASE.rst -> ManimGLPango-0.1.0\docs
copying docs\conf.py -> ManimGLPango-0.1.0\docs
copying docs\index.rst -> ManimGLPango-0.1.0\docs
copying docs\make.bat -> ManimGLPango-0.1.0\docs
copying docs\reference.rst -> ManimGLPango-0.1.0\docs
copying docs\_static\favicon.ico -> ManimGLPango-0.1.0\docs\_static
copying docs\_templates\autosummary\class.rst -> ManimGLPango-0.1.0\docs\_templates\autosummary
copying docs\_templates\autosummary\module.rst -> ManimGLPango-0.1.0\docs\_templates\autosummary
copying manimglpango\__init__.py -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\_version.py -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\cairo.pxd -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\cmanimpango.c -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\cmanimpango.pxd -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\cmanimpango.pyx -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\glib.pxd -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\pango.pxd -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\register_font.c -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\register_font.pxd -> ManimGLPango-0.1.0\manimglpango
copying manimglpango\register_font.pyx -> ManimGLPango-0.1.0\manimglpango
copying tests\__init__.py -> ManimGLPango-0.1.0\tests
copying tests\_manim.py -> ManimGLPango-0.1.0\tests
copying tests\conftest.py -> ManimGLPango-0.1.0\tests
copying tests\svg_tester.py -> ManimGLPango-0.1.0\tests
copying tests\test_colors.py -> ManimGLPango-0.1.0\tests
copying tests\test_fonts.py -> ManimGLPango-0.1.0\tests
copying tests\test_list_fonts.py -> ManimGLPango-0.1.0\tests
copying tests\test_markup.py -> ManimGLPango-0.1.0\tests
copying tests\test_version.py -> ManimGLPango-0.1.0\tests
copying tests\fonts\AdobeVFPrototype.ttf -> ManimGLPango-0.1.0\tests\fonts
copying tests\fonts\BungeeColor-Regular_colr_Windows.ttf -> ManimGLPango-0.1.0\tests\fonts
copying tests\fonts\BungeeOutline-Regular.ttf -> ManimGLPango-0.1.0\tests\fonts
copying tests\fonts\LICENSE.txt -> ManimGLPango-0.1.0\tests\fonts
copying tests\fonts\MaShanZheng-Regular.ttf -> ManimGLPango-0.1.0\tests\fonts
Writing ManimGLPango-0.1.0\setup.cfg
Creating tar archive
removing 'ManimGLPango-0.1.0' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (Cython>=0.27, setuptools, wheel)
* Getting dependencies for wheel...
running egg_info
writing ManimGLPango.egg-info\PKG-INFO
writing dependency_links to ManimGLPango.egg-info\dependency_links.txt
writing top-level names to ManimGLPango.egg-info\top_level.txt
reading manifest file 'ManimGLPango.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs\_build'
adding license file 'LICENSE'
writing manifest file 'ManimGLPango.egg-info\SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\manimglpango
copying manimglpango\_version.py -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\__init__.py -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\cairo.pxd -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\cmanimpango.pxd -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\glib.pxd -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\pango.pxd -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\register_font.pxd -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\cmanimpango.pyx -> build\lib.win-amd64-3.9\manimglpango
copying manimglpango\register_font.pyx -> build\lib.win-amd64-3.9\manimglpango
running build_ext
building 'manimglpango.cmanimpango' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\manimglpango
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DUNICODE=1 -ID:/msys64/mingw64/include/pango-1.0 -ID:/msys64/mingw64/include -ID:/msys64/mingw64/include/glib-2.0 -ID:/msys64/mingw64/lib/glib-2.0/include -ID:/msys64/mingw64/include/harfbuzz -ID:/msys64/mingw64/include/freetype2 -ID:/msys64/mingw64/include/libpng16 -ID:/msys64/mingw64/include/fribidi -ID:/msys64/mingw64/include/cairo -ID:/msys64/mingw64/include/lzo -ID:/msys64/mingw64/include/pixman-1 -ID:/msys64/mingw64/include/pango-1.0 -ID:/msys64/mingw64/include -ID:/msys64/mingw64/include/glib-2.0 -ID:/msys64/mingw64/lib/glib-2.0/include -ID:/msys64/mingw64/include/harfbuzz -ID:/msys64/mingw64/include/freetype2 -ID:/msys64/mingw64/include/libpng16 -ID:/msys64/mingw64/include/fribidi -ID:/msys64/mingw64/include/cairo -ID:/msys64/mingw64/include/lzo -ID:/msys64/mingw64/include/pixman-1 -IC:\Users\Michael\AppData\Local\Temp\build-env-otdpedt6\include -ID:\python\include -ID:\python\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcmanimglpango\cmanimpango.c /Fobuild\temp.win-amd64-3.9\Release\manimglpango\cmanimpango.obj -mms-bitfields -mms-bitfields -mms-bitfields -mms-bitfields -mms-bitfields -pthread -mms-bitfields -mms-bitfields -mms-bitfields -pthread -mms-bitfields -mms-bitfields
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-pthread”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-pthread”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cl: 命令行 warning D9002 :忽略未知选项“-mms-bitfields”
cmanimpango.c
D:/msys64/mingw64/include\stdio.h(577): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(584): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(590): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(844): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(870): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(1224): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(1231): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(1237): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(1353): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdio.h(1363): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\swprintf.inl(27): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\swprintf.inl(34): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdlib.h(389): error C2085: “_exit”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(389): error C2143: 语法错误: 缺少“;”(在“类型”的前面)
D:/msys64/mingw64/include\stdlib.h(396): error C2085: “_Exit”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(396): error C2143: 语法错误: 缺少“;”(在“类型”的前面)
D:/msys64/mingw64/include\stdlib.h(399): error C2085: “_Exit”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(399): error C2143: 语法错误: 缺少“;”(在“{”的前面)
D:/msys64/mingw64/include\stdlib.h(399): warning C4013: “_exit”未定义;假设外部返回 int
D:/msys64/mingw64/include\stdlib.h(399): error C2065: “status”: 未声明的标识符
D:/msys64/mingw64/include\stdlib.h(405): error C2059: 语法错误:“类型”
D:/msys64/mingw64/include\stdlib.h(681): error C2491: “_beep”: 不允许 dllimport 函数 的定义
D:/msys64/mingw64/include\stdlib.h(683): error C2085: “_seterrormode”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(683): error C2143: 语法错误: 缺少“;”(在“类型”的前面)
D:/msys64/mingw64/include\stdlib.h(684): error C2085: “_sleep”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(684): error C2143: 语法错误: 缺少“;”(在“类型”的前面)
D:/msys64/mingw64/include\stdlib.h(705): error C2085: “ecvt”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(706): error C2085: “fcvt”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(707): error C2085: “gcvt”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(708): error C2085: “itoa”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(709): error C2085: “ltoa”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(710): error C2085: “putenv”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(714): error C2085: “swab”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(717): error C2085: “ultoa”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(718): error C2085: “onexit”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(724): error C2085: “lldiv_t”: 不在形参表中
D:/msys64/mingw64/include\stdlib.h(726): error C2061: 语法错误: 标识符“lldiv_t”
D:/msys64/mingw64/include\stdlib.h(730): error C2169: “llabs”: 内部函数,不能定义
D:/msys64/mingw64/include\malloc.h(80): fatal error C1083: 无法打开包括文件: “mm_malloc.h”: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
ERROR Backend subproccess exited when trying to invoke build_wheel
When installing with either AUR or PIP I get an error that "glib.h" is not found gcc when compiling cmanimpango.c
. Given that that seems to be a local header as it is included with "" rather than <> it seems almost if there is some dependency that is not packaged.
Currently, this project is just for the use of Manim, and mostly it can't be used outside of manim, with the functions it provides.
Having a stable API so that it can be used outside of Manim would be super cool, for example, I recently read python-pillow/Pillow#2255 and found that Pillow can't render text correctly, especially for languages with more ligatures, at least it requires raqm and isn't available by default in the wheels, and by if we had a stable API Pillow could use this to render text.
I would like to hear some ideas on how this can be done and how the API should look like.
Thoughts @PhilippImhof?
With Mac OS X 10.14.6, I get the following error with "ManimPango v0.4.0.post1, Python v3.9.7":
Original error: dlopen(/.../lib/python3.9/site-packages/manimpango/cmanimpango.cpython-39-darwin.so, 2): Symbol not found: ___darwin_check_fd_set_overflow
Referenced from: /.../lib/python3.9/site-packages/manimpango/.dylibs/libX11.6.dylib (which was built for Mac OS X 11.0)
Expected in: /usr/lib/libSystem.B.dylib
in /.../lib/python3.9/site-packages/manimpango/.dylibs/libX11.6.dylib
Most likely the key is that libX11.6.dylib (which was built for Mac OS X 11.0)
, and downgrading to v0.4.0.post0
fixes the issue.
Not sure if there is something to be done here, but is there any strategy for pinning appropriate versions in a platform dependent way, either with Conda, poetry, or pip?
Sorry to bother you, I'm currently preparing for an important exam and I don't have much time to spend on GitHub. But I found that the Action used to build the document in 3b1b/manim failed in a run 3 days ago (https://github.com/3b1b/manim/runs/2300857732). The following is the error message:
Collecting manimpango<0.3.0',>=0.2.0
Downloading ManimPango-0.2.5.post0.tar.gz (455 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmphiy_wfhh get_requires_for_build_wheel /tmp/tmph92gvin_
cwd: /tmp/pip-install-t40xq14y/manimpango
Complete output (33 lines):
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
Traceback (most recent call last):
File "setup.py", line 129, in check_min_version
check_call(command, stdout=subprocess.DEVNULL)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['pkg-config', '--print-errors', '--atleast-version', '1.30.0', 'pangocairo']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/tmphiy_wfhh", line 280, in <module>
main()
File "/tmp/tmphiy_wfhh", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmphiy_wfhh", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-18yciq1c/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel
return self._get_build_requires(
File "/tmp/pip-build-env-18yciq1c/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-18yciq1c/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 258, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-18yciq1c/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 194, in <module>
_pkg_config.check_min_version(MINIMUM_PANGO_VERSION)
File "setup.py", line 132, in check_min_version
raise RequiredDependencyException(f"{self.name} >= {version} is required")
__main__.RequiredDependencyException: pangocairo >= 1.30.0 is required
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmphiy_wfhh get_requires_for_build_wheel /tmp/tmph92gvin_ Check the logs for full command output.
Error: Process completed with exit code 1.
This run corresponds to 3b1b/manim@f6291d7, which merged 3b1b/manim#1421. But the check for this pull request passed a month ago: https://github.com/3b1b/manim/actions/runs/609607503.
So I think it is a problem with the installation of the new version of ManimPango.
This may be an easy problem to deal with. But please forgive me for not having time to fix it at the moment. So can you take a look at this problem and create a PR in 3b1b/manim to fix it?
Right now, the usage in manim/mobject/svg/text_mobject.py
is this:
if sys.platform.startswith("linux"):
manimpango.unregister_font()
else:
manimpango.unregister_font(str(file_path))
It would be nice to pull this check into unregister_file
itself.
[yuri@yv /usr/ports/graphics/py-ManimPango/work-py39/ManimPango-0.4.3/tests]$ pytest .
ImportError while loading conftest '/usr/ports/graphics/py-ManimPango/work-py39/ManimPango-0.4.3/tests/conftest.py'.
conftest.py:7: in <module>
import manimpango
../manimpango/__init__.py:35: in <module>
raise ImportError(msg)
E ImportError:
E
E ManimPango could not import and load the necessary shared libraries.
E This error may occur when ManimPango and its dependencies are improperly set up.
E Please make sure the following versions are what you expect:
E
E * ManimPango v0.4.3, Python v3.9.16
E
E If you believe there is a greater problem,
E feel free to contact us or create an issue on GitHub:
E
E * Discord: https://www.manim.community/discord/
E * GitHub: https://github.com/ManimCommunity/ManimPango/issues
E
E Original error: No module named 'manimpango.cmanimpango'
However, 'import manimpango' succeeds in the Python interpreter.
ManimPango-0.4.3
Python-3.9
FreeBSD 13.1
when installing on manjaro through pamac, this error occurs and building fails.
i am getting this error while running manim
i have python 3.11.5
maninpango 0.4.4
manim 0.17.3
pango 1.50.14
py3cairo 1.25.0
scipy 1.11.3
ffmpeg 6.0_1
from .cmanimpango import *
ImportError: dlopen(/Users/endra/Manim/v0.17.3/venv/lib/python3.11/site-packages/manimpango/cmanimpango.cpython-311-darwin.so, 0x0002): Symbol not found: _pango_cairo_create_layout
Referenced from: <542EB9D6-9D9E-3A46-A342-A55098D19BB0> /Users/endra/Manim/v0.17.3/venv/lib/python3.11/site-packages/manimpango/cmanimpango.cpython-311-darwin.so
Expected in: unknown
I have recently turned to use a MacBook with M1, whose architecture is arm64. It seems that manimpango
does not work well on my new Mac due to architecture issues. To fix this, I have used an arm64 brew to reinstall pango
and an arm64 pip (python 3.10) to reinstall manimpango
(I have used this approach to fix my cairo
issues and it worked). However, the issue has not been fixed and when I import manimpango
it throws:
>>> import manimpango
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/__init__.py", line 14, in <module>
from .cmanimpango import * # noqa: F403,F401
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/cmanimpango.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_cairo_create)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/__init__.py", line 35, in <module>
raise ImportError(msg)
ImportError:
ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:
* ManimPango v0.4.1, Python v3.10.6
If you believe there is a greater problem,
feel free to contact us or create an issue on GitHub:
* Discord: https://www.manim.community/discord/
* GitHub: https://github.com/ManimCommunity/ManimPango/issues
Original error: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/manimpango/cmanimpango.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_cairo_create)
I know it is an architecture problem, but where is it?
Currently, if we changed PangoCairo backends, register_font
won't work as expected. And shifting backend is as simple as PANGOCARIO_BACKEND
variable to fc
, this should work on both Wheels distributed on Windows and macOS. (This isn't a thing on Linux as Fontconfig is the default backend). This can help in testing because rendering would be the same if the font backends are the same.
On fresh Ubuntu 22.04 install:
apt install libpango1.0-dev pkg-config python3-dev
was insufficient to pip install manimpango
Had to add:
apt install build-essential
for it to work.
Building wheel for ManimPango (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /home/windabove/.conda/envs/manim/bin/python /home/windabove/.conda/envs/manim/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpggpgl71f
cwd: /tmp/pip-req-build-bu2z0zs7
Complete output (34 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/manimpango
copying manimpango/__init__.py -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/utils.py -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/_version.py -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/register_font.pxd -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/cairo.pxd -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/glib.pxd -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/cmanimpango.pxd -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/pango.pxd -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/register_font.pyx -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/enums.pyx -> build/lib.linux-x86_64-3.8/manimpango
copying manimpango/cmanimpango.pyx -> build/lib.linux-x86_64-3.8/manimpango
running build_ext
building 'manimpango.cmanimpango' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/manimpango
gcc -pthread -B /home/windabove/.conda/envs/manim/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/home/windabove/.conda/envs/manim/include/python3.8 -c manimpango/cmanimpango.c -o build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o -pthread
gcc -pthread -shared -B /home/windabove/.conda/envs/manim/compiler_compat -L/home/windabove/.conda/envs/manim/lib -Wl,-rpath=/home/windabove/.conda/envs/manim/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -o build/lib.linux-x86_64-3.8/manimpango/cmanimpango.cpython-38-x86_64-linux-gnu.so
/home/windabove/.conda/envs/manim/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/windabove/.conda/envs/manim/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/crti.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/windabove/.conda/envs/manim/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtbeginS.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/home/windabove/.conda/envs/manim/compiler_compat/ld: warning: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtbeginS.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/home/windabove/.conda/envs/manim/compiler_compat/ld: build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o: unable to initialize decompress status for section .debug_info
/home/windabove/.conda/envs/manim/compiler_compat/ld: build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o: unable to initialize decompress status for section .debug_info
/home/windabove/.conda/envs/manim/compiler_compat/ld: build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o: unable to initialize decompress status for section .debug_info
/home/windabove/.conda/envs/manim/compiler_compat/ld: build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.8/manimpango/cmanimpango.o: file not recognized: file format not recognized
collect2: Error:ld return 1
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for ManimPango
Failed to build ManimPango
ERROR: Could not build wheels for ManimPango which use PEP 517 and cannot be installed directly
OS configuration:
Hello.
I'm having a trouble rendering a Text Mobject. An attempt of creating a Text Mobject retrieves TypeError because manimpango.text2svg
function has incorrect argument typing (size: int, line_spacing: int
istead of both being float
). Traceback is represented on screenshots attached.
The problem is I just don't know how to save any type of changes made to them .pyx
files.
Steps to reproduce the problem:
conda install -c conda-forge manim
on Conda's Python 3.11.6;manim -pqh scene.py TextAnimation
.Screenshots:
screenshot 1: ;
screenshot 2: .
Thanks for your response.
Currently we are setuptools like any other python project, which is fine, but I am strangely attracted to Meson, as a build system.
Meson is fast, other than that only feature I see, which is so hard to do with setuptools is that we can create C programs to for the testsuites. What I mean is we can write C programs to generate SVG files and compare it with what we generate. That should surely work because we are generating things in the same environment and testing the same.
While doing this would mean maintaining two different build system, one setuptools and other Meson, but I think Meson setup scripts are so easy to maintain than what we do at setuptools, also meson has subprojects, which in a way helps the users to build pango while installing manimpango, say they are on old linux, this may help.
Thoughts about it @PhilippImhof ?
When using gradients in MarkupText
we have Pango render the text to an SVG. We then load the SVG into a SVGMobject
and apply the gradient to the characters. This has two major drawbacks:
fl
counts for two characters but might be rendered as a single glyphSVGMobject
We will have to be careful w.r.t. the Write
animation. Currently, even with gradients every character has its own color. If the character is itself colored with a gradient, what color is to be used for the stroke?
There is a significant copy-pasting of the same code, for Text
and MarkupText
, instead if needs to be cleaned up so it is more maintainable.
Just tried this
>>> MarkupText('<<lllll><<>><><>©')
MarkupText('<<lllll><<>><><>©')
I see an empty SVG file created with the following warnings over at console.
(process:4516): Pango-WARNING **: 23:48:47.481: pango_layout_set_markup_with_accel: Error on line 1 char 17: “<lllll” is not a valid name
Suggestion: Use pango_parse_markup
and raise an error when markup is invalid. @PhilippImhof are you interested in doing this, or else I will do.
I have seen multiple issues on Discord as well as here, saying they can't run manimpango because the wheel returned a weird error. Maybe we should try compiling Pango on GH machines rather than using from brew. This needs some work though.
RTD can now install apt packages, so manim's rtd build won't need the wheels we built here. Also, it strangely started to fail and fixing it would take quite some work. So, I am going to remove it.
I got an email from GitHub today about this actions/runner-images#4312. I guess we should move to windows-2019
worker.
Console gives me error that "pangocairo >= 1.30.0 is required."
i tried installing pango with "pkg install libpango1.0-dev" in termux and it said "Unable to find a repository with name libpango1.0-dev"
We currently have a way to check whether the markup is valid or not, but that can be extended to having error messages that is understandable on where is the error is.
I have something working https://github.com/ManimCommunity/ManimPango/blob/cf13f34d4eec59e54143900e0a545d9c6ca0052f/manimpango/layout/utils.pyx which working on #48
Hi all,
I installed all the dependencies on ubuntu 20.04 following the install guide and manimce via pip install manim
. My installed manim version is 0.8 and manimpange is 0.3. When I run
from manim import *
I get the error:
ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:
ManimPango v0.3.0, Python v3.7.7
Original error: /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: hb_buffer_set_invisible_glyph
Any idea what is causing this?
Georg
This issue is for tracking and discussing removing the manylinux wheel provided by us and uploaded to PyPI.
We had already been warning users about this here.
On Linux, Pango is something that is part of the system itself being GNOME, so us packing Pango in wheels provided causes weird issues.
There could be many more please feel free to inform me.
The main cause of this problem is providing wheels which contain Pango and pip preferring to install wheel rather than compiling from source. The main reason I was tempted to build wheels was because of ReadtheDocs builds in ManimCommunity Docs doesn't have the Pango dev version installed...
Not to upload manylinux wheels to PyPI. Instead of that, uploading those wheels to Github Release can be done. On the ReadtheDocs build for ManimCommunity docs, those wheels can be hyperlinked in the requirements.txt file or set up a Conda Env so that Pango is provided by Conda.
There could be much more work feel free to edit this message.
I installed manimpango by
sudo apt install libpango1.0-dev
pip install manimpango
but I got some warning messages from pango when I ran python code with Text
(process:11839): Pango-WARNING **: 11:38:57.040: pango_layout_set_markup_with_accel: Attribute 'line_height' is not allowed on the <span> tag on line 1 char 134
and the content in Text
in the code cannot show up on the screen
It isn't that great that we can't justify a Paragraph of Text directly in Manim using MarkupText
. Also, there is a Paragraph
Mobject but it does things manually which Pango does for us. Also, we should make Paragraph object use these rather than implementing it by hand, as it is done currently.
these are the link to docs which we should implement
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-justify
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-indent
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-spacing
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-line-spacing
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-auto-dir
https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#pango-layout-set-alignment
This should be done after #30
cc @PhilippImhof
I think it should be better rather than just showing
ManimPango/manimpango/__init__.py
Lines 12 to 17 in f5dcf94
On Windows, the font file names passed through register_font
or unregister_font
raises an error if non-Ascii characters are present in the file path. This should be fixed.
>>> manimpango.register_font("庞门正道标题体2.0增强版.ttf")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 35-41: ordinal not in range(128)
Exception ignored in: 'manimpango.cmanimpango.register_font'
UnicodeEncodeError: 'ascii' codec can't encode characters in position 35-41: ordinal not in range(128)
False
I really don't know why this happens but running MarkupText
creates an SVG file which when viewed in browser is invisible.
The file size isn't less but I could see it has
[...]
<g id="surface26">
<g style="fill:rgb(100%,100%,100%);fill-opacity:1;">
<use xlink:href="#glyph0-1" x="30" y="32"/>
[...]
where the fill:rgb(100%,100%,100%)
means white and this makes the text invisible.
>>> from manim import MarkupText
>>> MarkupText("Hello")
MarkupText("Hello")
And the file media/texts/87d6c8ec25c88f0b.svg
should be created, which when opened on browser is invisible.
My Pango and Cairo version are
>>> import manimpango
>>> manimpango.cairo_version()
'1.17.4'
>>> manimpango.pango_version()
'1.48.1'
Is this expected @PhilippImhof ?
Currently, for testing, we require ManimCE to be installed, but that causes a circular dependency even though it is just for testing. My suggestion is not to depend on Manim, instead implement those classes in the test suite.
Initially, I followed the instructions of the Anaconda Installations command lines in Installation of manim.
My computer is Macbook Air (M1 chip, 8 cores GPU, 16 Gb Memory).
Here, is the problem described as an import error when I tried to run a brief code
manimgl example_scenes.py OpeningManimExample
OUTPUT:
Traceback (most recent call last):
File "/Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/__init__.py", line 14, in <module>
from .cmanimpango import * # noqa: F403,F401
ImportError: dlopen(/Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/cmanimpango.cpython-38-darwin.so, 2): Library not loaded: @rpath/libpangocairo-1.0.0.dylib
Referenced from: /Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/cmanimpango.cpython-38-darwin.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/micheallea/miniforge3/envs/manim/bin/manimgl", line 33, in <module>
sys.exit(load_entry_point('manimgl', 'console_scripts', 'manimgl')())
File "/Users/micheallea/miniforge3/envs/manim/bin/manimgl", line 25, in importlib_load_entry_point
return next(matches).load()
File "/Users/micheallea/miniforge3/envs/manim/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/Users/micheallea/miniforge3/envs/manim/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/micheallea/manim/manimlib/__init__.py", line 14, in <module>
from manimlib.animation.numbers import *
File "/Users/micheallea/manim/manimlib/animation/numbers.py", line 2, in <module>
from manimlib.mobject.numbers import DecimalNumber
File "/Users/micheallea/manim/manimlib/mobject/numbers.py", line 3, in <module>
from manimlib.mobject.svg.text_mobject import Text
File "/Users/micheallea/manim/manimlib/mobject/svg/text_mobject.py", line 15, in <module>
import manimpango
File "/Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/__init__.py", line 35, in <module>
raise ImportError(msg)
ImportError:
ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:
* ManimPango v0.3.1, Python v3.8.11
If you believe there is a greater problem,
feel free to contact us or create an issue on GitHub:
* Discord: https://discord.gg/mMRrZQW
* GitHub: https://github.com/ManimCommunity/ManimPango/issues
Original error: dlopen(/Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/cmanimpango.cpython-38-darwin.so, 2): Library not loaded: @rpath/libpangocairo-1.0.0.dylib
Referenced from: /Users/micheallea/miniforge3/envs/manim/lib/python3.8/site-packages/manimpango/cmanimpango.cpython-38-darwin.so
Reason: image not found
Have an M1 mac, tried to install manim, but after typing pip3 install manim
I get:
Collecting manim
Using cached manim-0.16.0.post0-py3-none-any.whl (528 kB)
Collecting manimpango<0.5.0,>=0.4.0.post0
Using cached ManimPango-0.4.1.tar.gz (4.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: scipy<2.0.0,>=1.7.3 in /opt/homebrew/lib/python3.10/site-packages (from manim) (1.9.1)
Collecting Pygments<3.0.0,>=2.10.0
Using cached Pygments-2.13.0-py3-none-any.whl (1.1 MB)
Collecting click-default-group<2.0.0,>=1.2.2
Using cached click_default_group-1.2.2-py3-none-any.whl
Collecting colour<0.2.0,>=0.1.5
Using cached colour-0.1.5-py2.py3-none-any.whl (23 kB)
Collecting Pillow<10.0,>=9.1
Using cached Pillow-9.2.0-cp310-cp310-macosx_11_0_arm64.whl (2.8 MB)
Requirement already satisfied: numpy<2.0,>=1.19 in /opt/homebrew/lib/python3.10/site-packages (from manim) (1.23.2)
Collecting click>=7.2
Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting srt<4.0.0,>=3.5.0
Using cached srt-3.5.2-py3-none-any.whl
Collecting pydub<0.26.0,>=0.25.1
Using cached pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting tqdm<5.0.0,>=4.62.3
Using cached tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting isosurfaces==0.1.0
Using cached isosurfaces-0.1.0-py3-none-any.whl (10 kB)
Collecting mapbox-earcut<0.13.0,>=0.12.10
Using cached mapbox_earcut-0.12.11-cp310-cp310-macosx_12_0_arm64.whl
Collecting moderngl<6.0.0,>=5.6.3
Using cached moderngl-5.6.4-cp310-cp310-macosx_10_9_universal2.whl (234 kB)
Collecting cloup<0.14.0,>=0.13.0
Using cached cloup-0.13.1-py2.py3-none-any.whl (51 kB)
Collecting watchdog<3.0.0,>=2.1.6
Using cached watchdog-2.1.9-cp310-cp310-macosx_11_0_arm64.whl (88 kB)
Collecting decorator<6.0.0,>=5.0.7
Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting rich!=12.0.0,>=6.0
Using cached rich-12.5.1-py3-none-any.whl (235 kB)
Collecting requests<3.0.0,>=2.26.0
Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting networkx<3.0,>=2.5
Using cached networkx-2.8.6-py3-none-any.whl (2.0 MB)
Requirement already satisfied: pycairo<2.0,>=1.19 in /opt/homebrew/lib/python3.10/site-packages (from manim) (1.21.0)
Collecting skia-pathops<0.8.0,>=0.7.0
Using cached skia_pathops-0.7.2-cp310-cp310-macosx_10_9_universal2.whl (2.9 MB)
Collecting screeninfo<0.9,>=0.8
Using cached screeninfo-0.8-py3-none-any.whl (14 kB)
Collecting moderngl-window<3.0.0,>=2.3.0
Using cached moderngl_window-2.4.1-py3-none-any.whl (365 kB)
Collecting glcontext<3,>=2
Using cached glcontext-2.3.6-cp310-cp310-macosx_10_9_universal2.whl (12 kB)
Collecting pyrr<1,>=0.10.3
Using cached pyrr-0.10.3-py3-none-any.whl (46 kB)
Collecting pyglet<2,>=1.5.8
Using cached pyglet-1.5.26-py3-none-any.whl (1.1 MB)
Collecting certifi>=2017.4.17
Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting idna<4,>=2.5
Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting charset-normalizer<3,>=2
Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting commonmark<0.10.0,>=0.9.0
Using cached commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
Collecting Cython
Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB)
Collecting pyobjc-framework-Cocoa
Using cached pyobjc_framework_Cocoa-8.5-cp310-cp310-macosx_10_9_universal2.whl (388 kB)
Collecting multipledispatch
Using cached multipledispatch-0.6.0-py3-none-any.whl (11 kB)
Collecting pyobjc-core>=8.5
Using cached pyobjc_core-8.5-cp310-cp310-macosx_10_9_universal2.whl (578 kB)
Collecting six
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: manimpango
Building wheel for manimpango (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for manimpango (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AssertionError:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-12-arm64-cpython-310
creating build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/_version.py -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/__init__.py -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/utils.py -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/cmanimpango.pxd -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/cairo.pxd -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/register_font.pxd -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/pango.pxd -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/glib.pxd -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/enums.pyx -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/register_font.pyx -> build/lib.macosx-12-arm64-cpython-310/manimpango
copying manimpango/cmanimpango.pyx -> build/lib.macosx-12-arm64-cpython-310/manimpango
running build_ext
building 'manimpango.cmanimpango' extension
creating build/temp.macosx-12-arm64-cpython-310
creating build/temp.macosx-12-arm64-cpython-310/manimpango
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/opt/homebrew/Cellar/pango/1.50.9/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/5.1.0/include/harfbuzz -I/opt/homebrew/Cellar/pango/1.50.9/include/pango-1.0 -I/opt/homebrew/Cellar/glib/2.72.3_1/include -I/opt/homebrew/Cellar/fribidi/1.0.12/include/fribidi -I/opt/homebrew/Cellar/harfbuzz/5.1.0/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo -I/opt/homebrew/Cellar/glib/2.72.3_1/include -I/opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.3_1/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -I/opt/homebrew/Cellar/pixman/0.40.0/include/pixman-1 -I/opt/homebrew/Cellar/fontconfig/2.14.0/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/libpng/1.6.37/include/libpng16 -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxrender/0.9.10/include -I/opt/homebrew/Cellar/libxext/1.3.4/include -I/opt/homebrew/Cellar/libx11/1.8.1/include -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxau/1.0.10/include -I/opt/homebrew/Cellar/libxdmcp/1.1.3/include -I/opt/homebrew/Cellar/xorgproto/2022.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/ffi -I/opt/homebrew/Cellar/pango/1.50.9/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/5.1.0/include/harfbuzz -I/opt/homebrew/Cellar/pango/1.50.9/include/pango-1.0 -I/opt/homebrew/Cellar/glib/2.72.3_1/include -I/opt/homebrew/Cellar/fribidi/1.0.12/include/fribidi -I/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo -I/opt/homebrew/Cellar/pixman/0.40.0/include/pixman-1 -I/opt/homebrew/Cellar/libpng/1.6.37/include/libpng16 -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxrender/0.9.10/include -I/opt/homebrew/Cellar/libxext/1.3.4/include -I/opt/homebrew/Cellar/libx11/1.8.1/include -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxau/1.0.10/include -I/opt/homebrew/Cellar/libxdmcp/1.1.3/include -I/opt/homebrew/Cellar/glib/2.72.3_1/include -I/opt/homebrew/Cellar/harfbuzz/5.1.0/include/harfbuzz -I/opt/homebrew/Cellar/graphite2/1.3.14/include -I/opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.3_1/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -I/opt/homebrew/Cellar/fontconfig/2.14.0/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/xorgproto/2022.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/ffi -I/opt/homebrew/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c manimpango/cmanimpango.c -o build/temp.macosx-12-arm64-cpython-310/manimpango/cmanimpango.o
clang: error: no such file or directory: 'manimpango/cmanimpango.c'
clang: error: no input files
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for manimpango
Failed to build manimpango
ERROR: Could not build wheels for manimpango, which is required to install pyproject.toml-based projects
I tried to solve the problem by running brew install pango pkg-config
as was said on this website:
https://github.com/ManimCommunity/manimpango#linuxmacos
But, after doing that it still gave the same error when I typed pip3 install manim
Can you please help me?
Currently, we have a small test suite. I would like to have Code Coverage enabled here. For that, I found these
https://stackoverflow.com/questions/34935796/how-to-use-coverage-analysis-with-cython
http://docs.cython.org/src/tutorial/profiling_tutorial.html
http://blog.behnel.de/posts/coverage-analysis-for-cython-modules.html
This will make sure that things will work.
I'm a newbie to the community here; I may need help in installing the MANIM software, which follows:
#clang: error: no such file or directory: 'manimpango/cmanimpango.c' clang: error: no input files error: command '/usr/bin/clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for **manimpango** Failed to build manimpango ERROR: Could not build wheels for **manimpango**, which is required to install pyproject.toml-based projects
When using git-sim merge develop
everything works fine. When trying git-sim rebase develop
I get this error:
Traceback (most recent call last):
File "/opt/homebrew/bin/git-sim", line 8, in <module>
sys.exit(main())
File "/opt/homebrew/lib/python3.10/site-packages/git_sim/__main__.py", line 89, in main
scene.render()
File "/opt/homebrew/lib/python3.10/site-packages/manim/scene/scene.py", line 223, in render
self.construct()
File "/opt/homebrew/lib/python3.10/site-packages/git_sim/git_sim.py", line 56, in construct
self.command.execute()
File "/opt/homebrew/lib/python3.10/site-packages/git_sim/git_sim_rebase.py", line 48, in execute
current = self.commits[i]
IndexError: list index out of range
I tried this on Apple Silicon, on a fresh installation as of 2023-01-23.
For some reason, wheels for macOS in v0.4.0 is causing issues with manim tests in ManimCommunity/manim#2341
Probably try and test with a shared wheel build to see if it fixes the issue.
This seems to be missing on macOS. I have found an API which seems to be revalent to what we want to, https://developer.apple.com/documentation/coretext/1499468-ctfontmanagerregisterfontsforurl?language=objc, but that is objective-c or swift.
cc @PhilippImhof
I pulled from latest master today and began getting import issues when importing manimpango - "Couldn't load the necessary Shared Libraries." in manimpango's init.py.
Run the manim scene, but importing fails
class GraphAreaPlot(GraphScene):
def __init__(self, **kwargs):
GraphScene.__init__(
self,
x_min=0,
x_max=5,
y_min=0,
y_max=6,
x_labeled_nums=[0,2,3],
**kwargs)
def construct(self):
self.setup_axes()
curve1 = self.get_graph(lambda x: 4 * x - x ** 2, x_min=0, x_max=4)
curve2 = self.get_graph(lambda x: 0.8 * x ** 2 - 3 * x + 4, x_min=0, x_max=4)
line1 = self.get_vertical_line_to_graph(2, curve1, DashedLine, color=YELLOW)
line2 = self.get_vertical_line_to_graph(3, curve1, DashedLine, color=YELLOW)
area1 = self.get_area(curve1, 0.3, 0.6, dx_scaling=10, area_color=BLUE)
area2 = self.get_area(curve2, 2, 3, bounded=curve1)
self.add(curve1, curve2, line1, line2, area1, area2)
Traceback (most recent call last):
File "/Users/ryan/PycharmProjects/manim-community/venv/lib/python3.7/site-packages/manimpango/__init__.py", line 11, in <module>
from .cmanimpango import * # noqa: F403,F401
ImportError: dlopen(/Users/ryan/PycharmProjects/manim-community/venv/lib/python3.7/site-packages/manimpango/cmanimpango.cpython-37m-darwin.so, 2): Symbol not found: ____chkstk_darwin
Referenced from: /Users/ryan/PycharmProjects/manim-community/venv/lib/python3.7/site-packages/manimpango/.dylibs/libfreetype.6.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/ryan/PycharmProjects/manim-community/venv/lib/python3.7/site-packages/manimpango/.dylibs/libfreetype.6.dylib
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ryan/PycharmProjects/manim-community/manim/__main__.py", line 5, in <module>
from manim import logger, config
File "/Users/ryan/PycharmProjects/manim-community/manim/__init__.py", line 47, in <module>
from .mobject.svg.text_mobject import *
File "/Users/ryan/PycharmProjects/manim-community/manim/mobject/svg/text_mobject.py", line 56, in <module>
import manimpango
File "/Users/ryan/PycharmProjects/manim-community/venv/lib/python3.7/site-packages/manimpango/__init__.py", line 13, in <module>
raise ImportError("Couldn't load the necessary Shared Libraries.")
ImportError: Couldn't load the necessary Shared Libraries.
arrow 0.17.0
attrs 20.3.0
cairocffi 1.2.0
cffi 1.14.4
colorama 0.4.4
colour 0.1.5
commonmark 0.9.1
decorator 4.4.2
importlib-metadata 3.1.0
iniconfig 1.1.1
Jinja2 2.11.2
jinja2-time 0.2.0
make 0.1.6.post2
manim 0.2.0
manimce 0.1.0
manimpango 0.1.7
MarkupSafe 1.1.1
networkx 2.5
numpy 1.19.4
packaging 20.7
pangocairocffi 0.4.0
pangocffi 0.8.0
Pillow 8.0.1
pip 20.3.3
pluggy 0.13.1
progressbar 2.5
py 1.9.0
pycairo 1.20.0
pycparser 2.20
pydub 0.24.1
Pygments 2.7.2
pyparsing 2.4.7
pytest 6.1.2
python-dateutil 2.8.1
rich 6.2.0
scipy 1.5.4
setuptools 50.3.2
six 1.15.0
toml 0.10.2
tqdm 4.54.0
typing-extensions 3.7.4.3
zipp 3.4.0
Output of ffmpeg -version
:
ffmpeg version 4.3.1-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
If it is just a case of an unsupported mac version I can upgrade, just wanted to see if it could be anything else.
Dear developers!
I have tried to install manim many times as per instructions of tutorial but failed to run the manim. I have MacBook Pro 16inch running Big Sur latest version. Here is error message what I get (latex is installed properly):
ramchand@MacBook-Pro manim-3b % python3 -m manim example_scenes.py WriteStuff -pl
Traceback (most recent call last):
File "/Users/ramchand/manim-3b/manimlib/extract_scene.py", line 153, in main
scene = SceneClass(**scene_kwargs)
File "/Users/ramchand/manim-3b/manimlib/scene/scene.py", line 54, in init
self.construct()
File "example_scenes.py", line 98, in construct
example_text = TextMobject(
File "/Users/ramchand/manim-3b/manimlib/mobject/svg/tex_mobject.py", line 143, in init
SingleStringTexMobject.init(
File "/Users/ramchand/manim-3b/manimlib/mobject/svg/tex_mobject.py", line 43, in init
file_name = tex_to_svg_file(
File "/Users/ramchand/manim-3b/manimlib/utils/tex_file_writing.py", line 19, in tex_to_svg_file
dvi_file = tex_to_dvi(tex_file)
File "/Users/ramchand/manim-3b/manimlib/utils/tex_file_writing.py", line 64, in tex_to_dvi
raise Exception(
Exception: Latex error converting to dvi. See log output above or the log file: /Users/ramchand/manim-3b/manimlib/files/Tex/47f78a457bde38f5.log
Please help me
Thank you very much!
Looks like Pango by default switched to the Dwrite backend, which means our previous method to add a font file into system fonts is not possible.
See GNOME/pango@3c947ec
Test suite failure: https://github.com/ManimCommunity/ManimPango/actions/runs/3572206031/jobs/6143567659#step:5:166
I'm using manim to render a complex plane with coordinate labels, which render number with Text and render unit with Tex.
My device has a 4k screen and uses 250% scale, and it's output has incorrect font size.
When I change 'manim/manimlib/mobject/svg/text_mobject.py:218'
to size / 4
, it will render as expected.
I think this problem should be solved in this project. Device's DPI is important when rendering svgs.
Recently I'm attempting to refactor Text
class in manimgl, and the job requires me to clone into ManimPango and rewrite it to fit the new structure for Text
. I had a problem when installing ManimPango via pip on my Windows. I followed instructions in README, and an error popped out while running pip install -e .
, which is listed as follows:
Obtaining file:///E://ManimKindergarten/ManimPango
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: D:/msys64/mingw64/bin/python.exe D:/msys64/mingw64/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel C:/Users/Michael/AppData/Local/Temp/tmprw4q63fg
cwd: E:/ManimKindergarten/ManimPango
Complete output (31 lines):
Failed to open 'D:/msys64/mingw64/lib/pkgconfig\freetype2.pc': Too many open files
Package 'freetype2', required by 'harfbuzz', not found
Traceback (most recent call last):
File "setup.py", line 130, in check_min_version
check_call(command, stdout=subprocess.DEVNULL)
File "D:/msys64/mingw64/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['pkg-config', '--print-errors', '--atleast-version', '1.30.0', 'pangocairo']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 280, in <module>
main()
File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
return self._get_build_requires(
File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
super(_BuildMetaLegacyBackend,
File "C:/Users/Michael/AppData/Local/Temp/pip-build-env-yphr7s_4/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 197, in <module>
_pkg_config_pangocairo.check_min_version(MINIMUM_PANGO_VERSION)
File "setup.py", line 133, in check_min_version
raise RequiredDependencyException(f"{self.name} >= {version} is required")
__main__.RequiredDependencyException: pangocairo >= 1.30.0 is required
I saw another similar issue #53, but it seems that it's already fixed. So it seems wierd to me. And, installing manimgl via pip install -e .
which relies on this dependency doesn't cause any problem. I've checked that MSYS2 MINGW64 shell was used to execute commands.
Any help will be appreciated :D
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.