KhamisiKibet/QT-PyQt-PySide-Custom-Widgets

OSError: no library called "cairo-2" was found

tejaswi-devalla opened this issue · 4 comments

Installed the new version
Tried to test:
from Custom_Widgets.ProgressIndicator import test
test.main()

It kept throwing the same error. What's the problem?

Screenshot (38)

klosto commented

Hi,
you must install package named cairocffi, it's special package, which you can't install with classical pip.

Firstly install package named pipwin:
pip install pipwin

Then just install cairocffi package through installed pipwin package:
pipwin install cairocffi

Hi,

I get the same error, I tried GTK install, and the pipwin command, it doesn't appear to work on Mac?

from Custom_Widgets.Widgets import loadJsonStyle File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/Custom_Widgets/__init__.py", line 16, in <module> from .Qss import SassCompiler File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/Custom_Widgets/Qss/SassCompiler.py", line 39, in <module> from . SvgToPngIcons import NewIconsGenerator File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/Custom_Widgets/Qss/SvgToPngIcons.py", line 1, in <module> import cairosvg File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/cairosvg/__init__.py", line 26, in <module> from . import surface # noqa isort:skip File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/cairosvg/surface.py", line 9, in <module> import cairocffi as cairo File "/Users/andrealves/Library/Python/3.9/lib/python/site-packages/cairocffi/__init__.py", line 47, in <module> cairo = dlopen( File "/Users/andrealves/Library/Python/3.9/lib/python/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': dlopen(libcairo.so.2, 0x0002): tried: 'libcairo.so.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache), 'libcairo.so.2' (no such file), '/usr/local/lib/libcairo.so.2' (no such file), '/usr/lib/libcairo.so.2' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.so.2' cannot load library 'libcairo.2.dylib': dlopen(libcairo.2.dylib, 0x0002): tried: 'libcairo.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache), 'libcairo.2.dylib' (no such file), '/usr/local/lib/libcairo.2.dylib' (no such file), '/usr/lib/libcairo.2.dylib' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo.2.dylib' cannot load library 'libcairo-2.dll': dlopen(libcairo-2.dll, 0x0002): tried: 'libcairo-2.dll' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache), 'libcairo-2.dll' (no such file), '/usr/local/lib/libcairo-2.dll' (no such file), '/usr/lib/libcairo-2.dll' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libcairo-2.dll'

While I load 'Custom_Widget' in python, I faced same issue on 'cairo'.
I did install cairocffi and GTK3-runtime program, too.
Do you have any idea to solve these errors?

Thank you.

from Custom_Widgets.Widgets import *
Traceback (most recent call last):
File "", line 1, in
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\Custom_Widgets_init_.py", line 16, in
from .Qss import SassCompiler
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\Custom_Widgets\Qss\SassCompiler.py", line 39, in
from . SvgToPngIcons import NewIconsGenerator
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\Custom_Widgets\Qss\SvgToPngIcons.py", line 1, in
import cairosvg
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\cairosvg_init_.py", line 26, in
from . import surface # noqa isort:skip
^^^^^^^^^^^^^^^^^^^^^
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\cairosvg\surface.py", line 9, in
import cairocffi as cairo
File "D:\python\pyqt\pyqt.venv\Lib\site-packages\cairocffi_init_.py", line 47, in
cairo = dlopen(
^^^^^^^
File "D:\python\pyqt\pyqt.venv\Lib\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': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a libr
ary called 'libcairo.so.2'
cannot load library 'libcairo.2.dylib': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a l
ibrary called 'libcairo.2.dylib'
cannot load library 'libcairo-2.dll': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a lib
rary called 'libcairo-2.dll'

klosto commented

Make sure, you are running supported version of Python. I use Python 3.10 and works fine for me.