Handling svg files

Hi,

I’m trying to convert .svg files to .png to be used in video files. Tried to install cairosvg for this conversion, but getting the error below:

Traceback (most recent call last):
  File "/home/runner/VideoGeneratorFinal/main.py", line 6, in <module>
    from video_processing import create_video_clips, generate_final_video
  File "/home/runner/VideoGeneratorFinal/video_processing.py", line 18, in <module>
    import cairosvg
  File "/home/runner/VideoGeneratorFinal/.pythonlibs/lib/python3.10/site-packages/cairosvg/__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "/home/runner/VideoGeneratorFinal/.pythonlibs/lib/python3.10/site-packages/cairosvg/surface.py", line 9, in <module>
    import cairocffi as cairo
  File "/home/runner/VideoGeneratorFinal/.pythonlibs/lib/python3.10/site-packages/cairocffi/__init__.py", line 47, in <module>
    cairo = dlopen(
  File "/home/runner/VideoGeneratorFinal/.pythonlibs/lib/python3.10/site-packages/cairocffi/__init__.py", line 44, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "cairo-2" was found
no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'

I’d appreciate your help.

Hello, how did you install the cairosvg package?
Use the Packages tool, or auto-guessing, to install it as this will also automatically install System dependencies.
System dependencies can also be managed in the System dependencies tool.

If that doesn’t work, there is a System dependency called python310Packages.cairosvg that should work as a replacement for it. (It may have some fixable import side effect errors, and is not recognized by the python package manager.)

1 Like