googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
242 stars 70 forks source link

Installation issue: "Failed building wheel for pycairo" #121

Closed irink closed 1 year ago

irink commented 5 years ago

This seems to be related to @chrissimpkins issue #106

@thundernixon and I tried pip install --upgrade git+https://github.com/googlefonts/gftools and ended with up the following error.

Failed building wheel for pycairo
  Running setup.py clean for pycairo
Successfully built gftools
Failed to build pycairo
fontdiffenator 0.7.6 has requirement Pillow==5.3.0, but you'll have pillow 5.4.1 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement idna==2.6, but you'll have idna 2.8 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement requests==2.18.4, but you'll have requests 2.21.0 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement urllib3==1.22, but you'll have urllib3 1.24.1 which is incompatible.
Installing collected packages: pycairo, fontdiffenator, olefile, simplejson, nose, pybrowserstack-screenshots, gfdiffbrowsers, gftools
  Running setup.py install for pycairo ... error
    Complete output from command /Users/irink/code/FiraCode/venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/y9/csr5qcb17_bf5j07c_mwktl000_5nq/T/pip-install-y209uhy_/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/y9/csr5qcb17_bf5j07c_mwktl000_5nq/T/pip-record-k39lex_u/install-record.txt --single-version-externally-managed --compile --install-headers /Users/irink/code/FiraCode/venv/bin/../include/site/python3.7/pycairo:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.7
    creating build/lib.macosx-10.13-x86_64-3.7/cairo
    copying cairo/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/cairo
    copying cairo/__init__.pyi -> build/lib.macosx-10.13-x86_64-3.7/cairo
    copying cairo/py.typed -> build/lib.macosx-10.13-x86_64-3.7/cairo
    running build_ext
    'pkg-config' not found.
    Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']

    ----------------------------------------
Command "/Users/irink/code/FiraCode/venv/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/y9/csr5qcb17_bf5j07c_mwktl000_5nq/T/pip-install-y209uhy_/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/y9/csr5qcb17_bf5j07c_mwktl000_5nq/T/pip-record-k39lex_u/install-record.txt --single-version-externally-managed --compile --install-headers /Users/irink/code/FiraCode/venv/bin/../include/site/python3.7/pycairo" failed with error code 1 in /private/var/folders/y9/csr5qcb17_bf5j07c_mwktl000_5nq/T/pip-install-y209uhy_/pycairo/

I followed Chris's advice and brew install cairo pkg-config freetype harfbuzz but it got the same error.

How might we install gftools with this issue?

Thanks!

chrissimpkins commented 5 years ago

If I am reading the error message correctly it seems to be indicating that pycairo can't find pkg-config during its install. Were there any messages about the pkg-config install during the Homebrew installation that you performed? Maybe a reboot after the brew install of pkg-config and try again?

thundernixon commented 5 years ago

Thanks so much for the quick response, @chrissimpkins!

We did get a message from brew recommending that several folders link usr/local/bin should get user permissions with sudo chown etc.

Irin is headed to another meeting, but we'll try to update this soon.


Small update: a simple use of a new terminal window (I think this is what you mean by "reboot," yes?) didn't make it work. We'll meet again next week and resume the efforts!

chrissimpkins commented 5 years ago

It looks like pycairo is trying to use the following command to identify a cairo install during the installation process:

pkg-config --print-errors --exists cairo >= 1.13.1

This is the path that I get for my Homebrew pkg-config install:

$ which pkg-config
/usr/local/bin/pkg-config

When/if time allows, try the following command to see if you can access the Homebrew installed executable:

$ /usr/local/bin/pkg-config --version

That might provide a more helpful error message.

If it is an issue with permissions on the /usr/local/bin directory you should see that in the error message. If pkg-config is not in that location, you should receive a message about that. Will be a good place to start. If you saw permissions comments on /usr/local/bin during the Homebrew install, it might be that you need to change the permissions on that directory. This may be preventing access to the executable if it is installed and the /usr/local/bin directory path is on your system PATH. And if the above command runs without issues, it is likely going to boil down to your PATH settings.

alexeiva commented 5 years ago

First, you need to make sure the dependencies are correct versions.

fontdiffenator 0.7.6 has requirement Pillow==5.3.0, but you'll have pillow 5.4.1 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement idna==2.6, but you'll have idna 2.8 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement requests==2.18.4, but you'll have requests 2.21.0 which is incompatible.
gfdiffbrowsers 0.1.3 has requirement urllib3==1.22, but you'll have urllib3 1.24.1 which is incompatible.

To downgrade them, first uninstall: pip uninstall Pillow idna requests urllib3

then install with specific versions: pip install Pillow==5.3.0 idna==2.6 requests==2.18.4 urllib3==1.22

I had the same problem with pycairo, managed to fix it following this comment

chrissimpkins commented 5 years ago

@irink @thundernixon did Alexei's suggestion in https://github.com/googlefonts/gftools/issues/121#issuecomment-464425138 lead to a successful install?

thundernixon commented 5 years ago

It's been awhile since we've been able to meet on this. However, in the time since, I've used a very similar approach to what Alexei suggested, and it's worked well!

(That is, instead of pip uninstall, I think it also works to use pip install -U Pillow==5.3.0, even if it's going back to an earlier version. Alexei's method might be better, however, so don't quote me on this).

I'll ask if we're still blocked on this, but I think this solves it. Thanks so much!

bghryct commented 5 years ago

I was working with Stephen and we ran into additional problems. Attempted Alexey's solution found that we couldn't install python cairo with brew. pip install pycairo left us with the following error message.

Command "/Users/mirkovelimirovic/Documents/GitHub/karmilla/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/25/kmj_l_sx4yg87mryzpkq9xr80000gp/T/pip-install-nxhz8kdw/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/25/kmj_l_sx4yg87mryzpkq9xr80000gp/T/pip-record-f3uo1kt1/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mirkovelimirovic/Documents/GitHub/karmilla/venv/include/site/python3.6/pycairo" failed with error code 1 in /private/var/folders/25/kmj_l_sx4yg87mryzpkq9xr80000gp/T/pip-install-nxhz8kdw/pycairo/
thundernixon commented 5 years ago

Still having problems here, now on a fresh setup of my own.

I'm trying to set up dependencies to build, fix, and check fonts with fontmake, gftools, and fontbakery, as documented at https://github.com/thundernixon/googlefonts-qa-template. However, I'm getting caught in the step of installing gftools, again on this error.

long command line quote ```zsh (venv) ~/type-repos/opensans master ✗ ▶ pip install -U git+https://github.com/googlefonts/gftools Collecting git+https://github.com/googlefonts/gftools Cloning https://github.com/googlefonts/gftools to /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-req-build-kjsaowvw Running command git clone -q https://github.com/googlefonts/gftools /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-req-build-kjsaowvw Running command git submodule update --init --recursive -q Requirement already satisfied, skipping upgrade: setuptools in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (41.0.1) Requirement already satisfied, skipping upgrade: FontTools in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.41.0) Requirement already satisfied, skipping upgrade: Flask in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: absl-py in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.7.1) Requirement already satisfied, skipping upgrade: glyphsLib in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.4.0b1) Requirement already satisfied, skipping upgrade: pillow in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (6.0.0) Requirement already satisfied, skipping upgrade: protobuf in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.7.1) Requirement already satisfied, skipping upgrade: requests in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (2.21.0) Requirement already satisfied, skipping upgrade: tabulate in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.8.3) Requirement already satisfied, skipping upgrade: unidecode in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (1.0.23) Requirement already satisfied, skipping upgrade: fontbakery in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.7.4) Collecting fontdiffenator (from gftools==0.2.0) Collecting gfdiffbrowsers (from gftools==0.2.0) Requirement already satisfied, skipping upgrade: Jinja2>=2.10 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (2.10.1) Requirement already satisfied, skipping upgrade: itsdangerous>=0.24 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (1.1.0) Requirement already satisfied, skipping upgrade: click>=5.1 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (7.0) Requirement already satisfied, skipping upgrade: Werkzeug>=0.14 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (0.15.2) Requirement already satisfied, skipping upgrade: six in ./venv/lib/python3.7/site-packages (from absl-py->gftools==0.2.0) (1.12.0) Requirement already satisfied, skipping upgrade: defcon>=0.3.0 in ./venv/lib/python3.7/site-packages (from glyphsLib->gftools==0.2.0) (0.6.0) Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (2.8) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (2019.3.9) Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (1.24.3) Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (3.0.4) Requirement already satisfied, skipping upgrade: recommonmark in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.5.0) Requirement already satisfied, skipping upgrade: sphinx>=1.4 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (2.0.1) Requirement already satisfied, skipping upgrade: lxml in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (4.3.3) Requirement already satisfied, skipping upgrade: opentype-sanitizer>=7.1.9 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (7.1.9) Requirement already satisfied, skipping upgrade: sphinx-rtd-theme in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.4.3) Requirement already satisfied, skipping upgrade: ufolint in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.3.5) Requirement already satisfied, skipping upgrade: font-v in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.7.1) Requirement already satisfied, skipping upgrade: ttfautohint-py in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.4.3) Requirement already satisfied, skipping upgrade: beautifulsoup4 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (4.7.1) Requirement already satisfied, skipping upgrade: uharfbuzz>=0.3.0 in ./venv/lib/python3.7/site-packages (from fontdiffenator->gftools==0.2.0) (0.5.0) Collecting pycairo>=1.18.0 (from fontdiffenator->gftools==0.2.0) Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz Requirement already satisfied, skipping upgrade: freetype-py>=2.0.0.post6 in ./venv/lib/python3.7/site-packages (from fontdiffenator->gftools==0.2.0) (2.1.0.post1) Collecting nose==1.3.7 (from gfdiffbrowsers->gftools==0.2.0) Using cached https://files.pythonhosted.org/packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Collecting olefile==0.44 (from gfdiffbrowsers->gftools==0.2.0) Collecting pybrowserstack-screenshots==0.1 (from gfdiffbrowsers->gftools==0.2.0) Collecting simplejson==3.12.0 (from gfdiffbrowsers->gftools==0.2.0) Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in ./venv/lib/python3.7/site-packages (from Jinja2>=2.10->Flask->gftools==0.2.0) (1.1.1) Requirement already satisfied, skipping upgrade: commonmark>=0.7.3 in ./venv/lib/python3.7/site-packages (from recommonmark->fontbakery->gftools==0.2.0) (0.9.0) Requirement already satisfied, skipping upgrade: docutils>=0.11 in ./venv/lib/python3.7/site-packages (from recommonmark->fontbakery->gftools==0.2.0) (0.14) Requirement already satisfied, skipping upgrade: sphinxcontrib-applehelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: packaging in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (19.0) Requirement already satisfied, skipping upgrade: sphinxcontrib-devhelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: sphinxcontrib-qthelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: Pygments>=2.0 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (2.4.0) Requirement already satisfied, skipping upgrade: snowballstemmer>=1.1 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.2.1) Requirement already satisfied, skipping upgrade: sphinxcontrib-htmlhelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: imagesize in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.1.0) Requirement already satisfied, skipping upgrade: alabaster<0.8,>=0.7 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (0.7.12) Requirement already satisfied, skipping upgrade: babel!=2.0,>=1.3 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (2.6.0) Requirement already satisfied, skipping upgrade: sphinxcontrib-serializinghtml in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.1.3) Requirement already satisfied, skipping upgrade: sphinxcontrib-jsmath in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: commandlines in ./venv/lib/python3.7/site-packages (from ufolint->fontbakery->gftools==0.2.0) (0.4.1) Requirement already satisfied, skipping upgrade: ufoLib>=2.2.0 in ./venv/lib/python3.7/site-packages (from ufolint->fontbakery->gftools==0.2.0) (2.3.2) Requirement already satisfied, skipping upgrade: gitpython in ./venv/lib/python3.7/site-packages (from font-v->fontbakery->gftools==0.2.0) (2.1.11) Requirement already satisfied, skipping upgrade: soupsieve>=1.2 in ./venv/lib/python3.7/site-packages (from beautifulsoup4->fontbakery->gftools==0.2.0) (1.9.1) Requirement already satisfied, skipping upgrade: future in ./venv/lib/python3.7/site-packages (from commonmark>=0.7.3->recommonmark->fontbakery->gftools==0.2.0) (0.17.1) Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in ./venv/lib/python3.7/site-packages (from packaging->sphinx>=1.4->fontbakery->gftools==0.2.0) (2.4.0) Requirement already satisfied, skipping upgrade: pytz>=0a in ./venv/lib/python3.7/site-packages (from babel!=2.0,>=1.3->sphinx>=1.4->fontbakery->gftools==0.2.0) (2019.1) Requirement already satisfied, skipping upgrade: gitdb2>=2.0.0 in ./venv/lib/python3.7/site-packages (from gitpython->font-v->fontbakery->gftools==0.2.0) (2.0.5) Requirement already satisfied, skipping upgrade: smmap2>=2.0.0 in ./venv/lib/python3.7/site-packages (from gitdb2>=2.0.0->gitpython->font-v->fontbakery->gftools==0.2.0) (2.0.5) Building wheels for collected packages: gftools, pycairo Building wheel for gftools (setup.py) ... done Stored in directory: /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-ephem-wheel-cache-0hvk0lg1/wheels/88/d8/f2/06cc29328953f614e7f3048be8b31c3787b7bc60b290dab235 Building wheel for pycairo (setup.py) ... error ERROR: Complete output from command /Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-oxq8nrrj/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-wheel-8u002c4x --python-tag cp37: ERROR: running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.14-x86_64-3.7 creating build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.pyi -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/py.typed -> build/lib.macosx-10.14-x86_64-3.7/cairo running build_ext Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'gobject-2.0', not found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1. ---------------------------------------- ERROR: Failed building wheel for pycairo Running setup.py clean for pycairo Successfully built gftools Failed to build pycairo ERROR: gfdiffbrowsers 0.1.4 has requirement Pillow==5.4.1, but you'll have pillow 6.0.0 which is incompatible. ERROR: gfdiffbrowsers 0.1.4 has requirement urllib3==1.24.1, but you'll have urllib3 1.24.3 which is incompatible. Installing collected packages: pycairo, fontdiffenator, nose, olefile, simplejson, pybrowserstack-screenshots, gfdiffbrowsers, gftools Running setup.py install for pycairo ... error ERROR: Complete output from command /Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-oxq8nrrj/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-record-b_z3re5w/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stephennixon/type-repos/opensans/venv/bin/../include/site/python3.7/pycairo: ERROR: running install running build running build_py creating build creating build/lib.macosx-10.14-x86_64-3.7 creating build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.pyi -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/py.typed -> build/lib.macosx-10.14-x86_64-3.7/cairo running build_ext Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'gobject-2.0', not found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1. ---------------------------------------- ERROR: Command "/Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-oxq8nrrj/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-record-b_z3re5w/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stephennixon/type-repos/opensans/venv/bin/../include/site/python3.7/pycairo" failed with error code 1 in /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-oxq8nrrj/pycairo/ ```

I've followed Chris's advice above. In a separate terminal, I did this:

▶ brew install cairo pkg-config freetype harfbuzz
Warning: cairo 1.16.0 is already installed and up-to-date
To reinstall 1.16.0, run `brew reinstall cairo`
Warning: freetype 2.10.0 is already installed and up-to-date
To reinstall 2.10.0, run `brew reinstall freetype`
Warning: harfbuzz 2.4.0_1 is already installed and up-to-date
To reinstall 2.4.0_1, run `brew reinstall harfbuzz`
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/85/85e5bbffb3424f22cd1bf54b69161110481bab100f9abea54e0a0f00fcf761b9?__gda__=exp=1557351589~hmac=6a52b4db802a133eb30bfbcc5ba0b90a9925eb839a30cf6353a8b4d77737fab5&response-content-disposition=attachment%3Bfilename%3D%22pkg-con
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.2KB

...then checked things back in my venv:

(venv) 
~/type-repos/opensans  master ✗                                                                                                                                
▶ which pkg-config
/usr/local/bin/pkg-config
(venv) 
~/type-repos/opensans  master ✗                                                                                                                                 
▶ /usr/local/bin/pkg-config --version
0.29.2

I also installed the requested versions of dependencies:

▶ pip install -U Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1

...but ended up with a very similar result as before:

long command line quote ``` (venv) ~/type-repos/opensans master ✗ ▶ pip install -U git+https://github.com/googlefonts/gftools Collecting git+https://github.com/googlefonts/gftools Cloning https://github.com/googlefonts/gftools to /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-req-build-saow4mjy Running command git clone -q https://github.com/googlefonts/gftools /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-req-build-saow4mjy Running command git submodule update --init --recursive -q Requirement already satisfied, skipping upgrade: setuptools in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (41.0.1) Requirement already satisfied, skipping upgrade: FontTools in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.41.0) Requirement already satisfied, skipping upgrade: Flask in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: absl-py in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.7.1) Requirement already satisfied, skipping upgrade: glyphsLib in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.4.0b1) Requirement already satisfied, skipping upgrade: pillow in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (5.4.1) Requirement already satisfied, skipping upgrade: protobuf in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (3.7.1) Requirement already satisfied, skipping upgrade: requests in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (2.21.0) Requirement already satisfied, skipping upgrade: tabulate in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.8.3) Requirement already satisfied, skipping upgrade: unidecode in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (1.0.23) Requirement already satisfied, skipping upgrade: fontbakery in ./venv/lib/python3.7/site-packages (from gftools==0.2.0) (0.7.4) Collecting fontdiffenator (from gftools==0.2.0) Collecting gfdiffbrowsers (from gftools==0.2.0) Requirement already satisfied, skipping upgrade: Werkzeug>=0.14 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (0.15.2) Requirement already satisfied, skipping upgrade: Jinja2>=2.10 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (2.10.1) Requirement already satisfied, skipping upgrade: click>=5.1 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (7.0) Requirement already satisfied, skipping upgrade: itsdangerous>=0.24 in ./venv/lib/python3.7/site-packages (from Flask->gftools==0.2.0) (1.1.0) Requirement already satisfied, skipping upgrade: six in ./venv/lib/python3.7/site-packages (from absl-py->gftools==0.2.0) (1.12.0) Requirement already satisfied, skipping upgrade: defcon>=0.3.0 in ./venv/lib/python3.7/site-packages (from glyphsLib->gftools==0.2.0) (0.6.0) Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (2019.3.9) Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (3.0.4) Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (2.8) Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in ./venv/lib/python3.7/site-packages (from requests->gftools==0.2.0) (1.24.1) Requirement already satisfied, skipping upgrade: lxml in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (4.3.3) Requirement already satisfied, skipping upgrade: sphinx>=1.4 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (2.0.1) Requirement already satisfied, skipping upgrade: font-v in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.7.1) Requirement already satisfied, skipping upgrade: recommonmark in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.5.0) Requirement already satisfied, skipping upgrade: ttfautohint-py in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.4.3) Requirement already satisfied, skipping upgrade: sphinx-rtd-theme in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.4.3) Requirement already satisfied, skipping upgrade: ufolint in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (0.3.5) Requirement already satisfied, skipping upgrade: opentype-sanitizer>=7.1.9 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (7.1.9) Requirement already satisfied, skipping upgrade: beautifulsoup4 in ./venv/lib/python3.7/site-packages (from fontbakery->gftools==0.2.0) (4.7.1) Requirement already satisfied, skipping upgrade: freetype-py>=2.0.0.post6 in ./venv/lib/python3.7/site-packages (from fontdiffenator->gftools==0.2.0) (2.1.0.post1) Collecting pycairo>=1.18.0 (from fontdiffenator->gftools==0.2.0) Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz Requirement already satisfied, skipping upgrade: uharfbuzz>=0.3.0 in ./venv/lib/python3.7/site-packages (from fontdiffenator->gftools==0.2.0) (0.5.0) Collecting simplejson==3.12.0 (from gfdiffbrowsers->gftools==0.2.0) Collecting olefile==0.44 (from gfdiffbrowsers->gftools==0.2.0) Collecting pybrowserstack-screenshots==0.1 (from gfdiffbrowsers->gftools==0.2.0) Collecting nose==1.3.7 (from gfdiffbrowsers->gftools==0.2.0) Using cached https://files.pythonhosted.org/packages/15/d8/dd071918c040f50fa1cf80da16423af51ff8ce4a0f2399b7bf8de45ac3d9/nose-1.3.7-py3-none-any.whl Requirement already satisfied, skipping upgrade: MarkupSafe>=0.23 in ./venv/lib/python3.7/site-packages (from Jinja2>=2.10->Flask->gftools==0.2.0) (1.1.1) Requirement already satisfied, skipping upgrade: alabaster<0.8,>=0.7 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (0.7.12) Requirement already satisfied, skipping upgrade: sphinxcontrib-jsmath in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: babel!=2.0,>=1.3 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (2.6.0) Requirement already satisfied, skipping upgrade: docutils>=0.12 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (0.14) Requirement already satisfied, skipping upgrade: sphinxcontrib-qthelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: sphinxcontrib-htmlhelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.2) Requirement already satisfied, skipping upgrade: sphinxcontrib-serializinghtml in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.1.3) Requirement already satisfied, skipping upgrade: Pygments>=2.0 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (2.4.0) Requirement already satisfied, skipping upgrade: sphinxcontrib-devhelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: packaging in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (19.0) Requirement already satisfied, skipping upgrade: sphinxcontrib-applehelp in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.0.1) Requirement already satisfied, skipping upgrade: imagesize in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.1.0) Requirement already satisfied, skipping upgrade: snowballstemmer>=1.1 in ./venv/lib/python3.7/site-packages (from sphinx>=1.4->fontbakery->gftools==0.2.0) (1.2.1) Requirement already satisfied, skipping upgrade: gitpython in ./venv/lib/python3.7/site-packages (from font-v->fontbakery->gftools==0.2.0) (2.1.11) Requirement already satisfied, skipping upgrade: commonmark>=0.7.3 in ./venv/lib/python3.7/site-packages (from recommonmark->fontbakery->gftools==0.2.0) (0.9.0) Requirement already satisfied, skipping upgrade: commandlines in ./venv/lib/python3.7/site-packages (from ufolint->fontbakery->gftools==0.2.0) (0.4.1) Requirement already satisfied, skipping upgrade: ufoLib>=2.2.0 in ./venv/lib/python3.7/site-packages (from ufolint->fontbakery->gftools==0.2.0) (2.3.2) Requirement already satisfied, skipping upgrade: soupsieve>=1.2 in ./venv/lib/python3.7/site-packages (from beautifulsoup4->fontbakery->gftools==0.2.0) (1.9.1) Requirement already satisfied, skipping upgrade: pytz>=0a in ./venv/lib/python3.7/site-packages (from babel!=2.0,>=1.3->sphinx>=1.4->fontbakery->gftools==0.2.0) (2019.1) Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in ./venv/lib/python3.7/site-packages (from packaging->sphinx>=1.4->fontbakery->gftools==0.2.0) (2.4.0) Requirement already satisfied, skipping upgrade: gitdb2>=2.0.0 in ./venv/lib/python3.7/site-packages (from gitpython->font-v->fontbakery->gftools==0.2.0) (2.0.5) Requirement already satisfied, skipping upgrade: future in ./venv/lib/python3.7/site-packages (from commonmark>=0.7.3->recommonmark->fontbakery->gftools==0.2.0) (0.17.1) Requirement already satisfied, skipping upgrade: smmap2>=2.0.0 in ./venv/lib/python3.7/site-packages (from gitdb2>=2.0.0->gitpython->font-v->fontbakery->gftools==0.2.0) (2.0.5) Building wheels for collected packages: gftools, pycairo Building wheel for gftools (setup.py) ... done Stored in directory: /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-ephem-wheel-cache-kxwchf2p/wheels/88/d8/f2/06cc29328953f614e7f3048be8b31c3787b7bc60b290dab235 Building wheel for pycairo (setup.py) ... error ERROR: Complete output from command /Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-ms0gj3lt/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-wheel-n440_9nk --python-tag cp37: ERROR: running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.14-x86_64-3.7 creating build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.pyi -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/py.typed -> build/lib.macosx-10.14-x86_64-3.7/cairo running build_ext Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'gobject-2.0', not found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1. ---------------------------------------- ERROR: Failed building wheel for pycairo Running setup.py clean for pycairo Successfully built gftools Failed to build pycairo Installing collected packages: pycairo, fontdiffenator, simplejson, olefile, pybrowserstack-screenshots, nose, gfdiffbrowsers, gftools Running setup.py install for pycairo ... error ERROR: Complete output from command /Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-ms0gj3lt/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-record-84y2653z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stephennixon/type-repos/opensans/venv/bin/../include/site/python3.7/pycairo: ERROR: running install running build running build_py creating build creating build/lib.macosx-10.14-x86_64-3.7 creating build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/__init__.pyi -> build/lib.macosx-10.14-x86_64-3.7/cairo copying cairo/py.typed -> build/lib.macosx-10.14-x86_64-3.7/cairo running build_ext Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'gobject-2.0', not found Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1. ---------------------------------------- ERROR: Command "/Users/stephennixon/type-repos/opensans/venv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-ms0gj3lt/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-record-84y2653z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stephennixon/type-repos/opensans/venv/bin/../include/site/python3.7/pycairo" failed with error code 1 in /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-ms0gj3lt/pycairo/ ```

I noticed three lines in particular:

Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libffi', required by 'gobject-2.0', not found

So I went into a new terminal and typed:

▶ brew install libffi
Warning: libffi 3.2.1 is already installed and up-to-date
To reinstall 3.2.1, run `brew reinstall libffi`

Things still didn't work, so I ran:

brew reinstall libffi

I followed the advice here and opened my ~/.bash_profile to add:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

I then tried to install gftools again, and it failed again with a message about incorrect dependency versions. So, from the numbers it requested, I ran another pip install:

(venv) 
~/type-repos/opensans  master ✗                                                                                                                                
▶ pip install -U Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1

Then tried to install gftools once more. And now gftools seems to have installed correctly.

So, @bghryct, I'm not sure if you've worked on this again yet, but it seems that for me, the magic step was brew reinstall libffi. However, the main thing was reading through the error messages and trying to follow the suggestions. Not ideal, but hopefully this helps a bit.

thundernixon commented 5 years ago

Reopening this issue because I've experienced variations of it on three different computers. There must be a simpler way to install gftools, without so much troubleshooting each time. Maybe that just requires deprecating / forking out the python2 tools, then getting this onto pypi?

bghryct commented 5 years ago

Thanks @thundernixon your suggestions worked, and I'm finally up and running. I agree that it would be nice if this were easier, but on the other hand I learned a lot about the tools while troubleshooting.

noponies commented 5 years ago

Thanks for the step through @thundernixon. Finally got this up and running as well.

hamid-zp commented 5 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

arialcrime commented 4 years ago

Ran into a problem similar to the one above and can confirm that adding this fixed it for me:

I followed the advice here and opened my ~/.bash_profile to add:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"

I very much agree that the installation process has to get less messy to make gftools a more accessible tools collection for everybody.

m4rc1e commented 4 years ago

@arialcrime For the time being, I'm tempted to have these dependencies as optional extras. If users then try to run scripts which need these dependencies, they'll be asked to install them. I'm also tempted to make python wheels like we have for ots. This should make everything just a simple pip install.

Alex-Mann commented 4 years ago

@arialcrime this worked for me on MacOS. Thanks.

suryakantamangaraj commented 4 years ago

For Windows OS:

  1. Visit the Download Page
  2. Select the download that corresponds to your PC's architecture and Python Version cp38 corresponds to Python 3.8, cp37 corresponds to Python 3.7, etc win_amd64 corresponds to 64-bit machines, win32 corresponds to 32-bit machines
  3. Then, run pip3 install (path/to/Cairo-file).whl, where the file the appropriate name of the .whl file
vesko-vujovic commented 4 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

This worked for me thanks! Ubuntu 18.04

Cahitisleyen commented 4 years ago

thanks it worked @hamid-zp

dttad commented 4 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

it works! awesome <3

ali-amirahmadii commented 4 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

Thank you very much, this works for me properly

afridi315 commented 4 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

Thank you, 💯 Worked for me, Ubuntu 20

Muhammad-Owais635 commented 2 years ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

thank you so much this works for me too

weiweihuanghuang commented 2 years ago

For anyone having the same issue:

I had to run the following while inside my venv:

I followed the advice here and opened my ~/.bash_profile to add:

export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
simoncozens commented 1 year ago

PyCairo being a pain to install is really a PyCairo issue not a gftools one, but it looks like we have found ways around this!

AvinandanPal25 commented 1 year ago

Hello all. I would like to draw your attention to an ISSUE that I came across and raised.

Kindly have a look. And if you can, guide me through it. I really appreciate any help you can provide. Head over to my My issue

erados commented 1 year ago

For some M1 Users, brew install pkg-config worked for me.

sonomirco commented 1 year ago

Hi all, I am trying to build an app using Streamlit with pycairo, but I am getting this error. image

This is the default GitHub action to push the app to Azure static web app.

image

Can anyone help me? Thanks.

pepguica commented 1 year ago

In Mac and following intructions from ChatGPT4

brew install cairo

After Cairo is successfully installed, try installing Pycairo again using pip:

pip install pycairo

trxsudo commented 1 year ago

In Mac and following intructions from ChatGPT4

brew install cairo

After Cairo is successfully installed, try installing Pycairo again using pip:

pip install pycairo

this helped me thanks man!!

Alptimus commented 1 year ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

Thank you Life saver :)

vsemecky commented 1 year ago

In Ubuntu, this works for me: sudo apt install libcairo2-dev pkg-config python3-dev and then: pip install pycairo

I don't use Ubuntu, but Colab and I can confirm that this solution works in Colab too!