Installing cairo

Hi, first time using streamlit (v excited!)

I’m having issues with installing an app with a cairo dependency from a pip requirements.txt file. Any tips? The relevant part of the error log is below. I just added pycairo to the requirements.txt file with no version number. Thanks!


  Building wheel for pycairo (PEP 517): started
  Building wheel for pycairo (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/ build_wheel /tmp/tmp74yh2kn5
       cwd: /tmp/pip-install-xs01h78a/pycairo_117a6fada8374b4481dacf0f0366dd17
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/cairo
  copying cairo/ -> build/lib.linux-x86_64-3.7/cairo
  copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.7/cairo
  copying cairo/py.typed -> build/lib.linux-x86_64-3.7/cairo
  running build_ext
  'pkg-config' not found.
  Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']
  ERROR: Failed building wheel for pycairo
  Building wheel for cairocffi ( started
  Building wheel for cairocffi ( finished with status 'done'
  Created wheel for cairocffi: filename=cairocffi-1.2.0-py3-none-any.whl size=89545 sha256=c6282712870039d31b8ad78a7db8fb7a0e98543f6785a2e8fc90f31826e62fd7
  Stored in directory: /home/appuser/.cache/pip/wheels/e2/ca/86/9db2824f203afe4bdf5aa6ead017f352fcc90e92f095b78871
  Building wheel for future ( started
  Building wheel for future ( finished with status 'done'
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=29f262841b732bb49b604091d0b4141f24667e0bdb5472b0d19b3286cb49ef52
  Stored in directory: /home/appuser/.cache/pip/wheels/56/b0/fe/4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0
Successfully built dash dash-core-components dash-html-components dash-table dash-renderer retrying cairocffi future
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 20.3.3; however, version 21.0 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

Update. I installed cairocffi, which worked, but now when I call the cairosvg library (from cairosvg import svg2png) in the app, it can’t find the cairo library

OSError: no library called "cairo" was found no library called "libcairo-2" was found cannot load library '': cannot open shared object file: No such file or directory cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory

File "/usr/local/lib/python3.7/site-packages/streamlit/", line 332, in _run_script
    exec(code, module.__dict__)File "/app/dash_doodler/", line 38, in <module>
    from annotations_to_segmentations_rf import *File "src/", line 62, in <module>
    from cairosvg import svg2pngFile "/home/appuser/.local/lib/python3.7/site-packages/cairosvg/", line 26, in <module>
    from . import surface  # noqa isort:skipFile "/home/appuser/.local/lib/python3.7/site-packages/cairosvg/", line 9, in <module>
    import cairocffi as cairoFile "/home/appuser/.local/lib/python3.7/site-packages/cairocffi/", line 50, in <module>
    ('', 'libcairo.2.dylib', 'libcairo-2.dll'))File "/home/appuser/.local/lib/python3.7/site-packages/cairocffi/", line 45, in dlopen
    raise OSError(error_message)  # pragma: no cover

(btw, what operating system is behind the hood when deploying apps? I cant find that info in the docs, and I had assumed it was some flavor of linux but now I’m not so sure …)

Thanks in advance!