gftools: Installation issue: "Failed building wheel for pycairo"
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!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 11
- Comments: 31 (11 by maintainers)
In Ubuntu, this works for me:
sudo apt install libcairo2-dev pkg-config python3-devand then:pip install pycairoStill 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
I’ve followed Chris’s advice above. In a separate terminal, I did this:
…then checked things back in my venv:
I also installed the requested versions of dependencies:
…but ended up with a very similar result as before:
long command line quote
I noticed three lines in particular:
So I went into a new terminal and typed:
Things still didn’t work, so I ran:
I followed the advice here and opened my
~/.bash_profileto add: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:
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.For some M1 Users,
brew install pkg-configworked for me.Thank you Life saver 😃
First, you need to make sure the dependencies are correct versions.
To downgrade them, first uninstall:
pip uninstall Pillow idna requests urllib3then install with specific versions:
pip install Pillow==5.3.0 idna==2.6 requests==2.18.4 urllib3==1.22I had the same problem with
pycairo, managed to fix it following this commentthank you so much this works for me too
Thank you, 💯 Worked for me, Ubuntu 20
In Mac and following intructions from ChatGPT4
brew install cairoAfter Cairo is successfully installed, try installing Pycairo again using pip:
pip install pycairoThank you very much, this works for me properly
@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.
Ran into a problem similar to the one above and can confirm that adding this fixed it for me:
I very much agree that the installation process has to get less messy to make gftools a more accessible tools collection for everybody.
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.
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?
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 usepip 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!