pythonlinuxcairopycairobeeware

Beeware 'briefcase create' asks for cairo >= 1.15.10


I'm following Beeware tutorial and unable to 'briefcase create'.

At some point it shows this:

Collecting pygobject>=3.14.0
  Downloading PyGObject-3.38.0.tar.gz (712 kB)
     |████████████████████████████████| 712 kB 6.9 MB/s 
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6esqaemw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (36 lines):
  WARNING: The directory '/home/brutus/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  Collecting setuptools
    Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting wheel
    Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting pycairo
    Downloading pycairo-1.20.0.tar.gz (344 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 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Building wheels for collected packages: pycairo
    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/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp426eh9du
         cwd: /tmp/pip-install-rmj9v5en/pycairo
    Complete output (12 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/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
    running build_ext
    Requested 'cairo >= 1.15.10' but version of cairo is 1.14.6
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6esqaemw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
Unable to install dependencies. This may be because one of your dependencies is invalid, or because pip was unable to connect to the PyPI server. 

I believe the main problem is

 Requested 'cairo >= 1.15.10' but version of cairo is 1.14.6

But what I don't understand is were is cairo 1.14.6 if I have only cairo 1.20.0 installed.

I tried to update docker, reinstall cairo and pycairo, updated python packages but the error is still there.


Solution

  • The beeware build process is trying to install the pycairo package. This package is just a python interface to the cairo graphics library (libcairo2).

    pycairo changelog shows, newest version 1.20.0 for pycairo, which requires cairo (libcairo2) version 1.15.10+.

    If you are lucky, you can simply update your cairo package to a version which satisfies the requirement. Info is on the official site cairographics.org/download/.

    I have the same problem as you. In my case I am again reminded to upgrade my OS to newer version of Ubuntu, since the cairo package libcairo2 is only available in version 14.6 in Ubuntu 16.04 LTS official PPA. In Ubuntu 20.04 LTS the available libcairo2 is 16.0. I suspect you have a simmilar OS, because your installed cairo version is the same as mine.