Closed irink closed 1 year 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?
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!
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.
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
@irink @thundernixon did Alexei's suggestion in https://github.com/googlefonts/gftools/issues/121#issuecomment-464425138 lead to a successful install?
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!
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/
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.
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:
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.
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?
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.
Thanks for the step through @thundernixon. Finally got this up and running as well.
In Ubuntu, this works for me:
sudo apt install libcairo2-dev pkg-config python3-dev
and then:
pip install pycairo
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.
@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.
@arialcrime this worked for me on MacOS. Thanks.
For Windows OS:
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
pip3 install (path/to/Cairo-file).whl
, where the file the appropriate name of the .whl
fileIn 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
thanks it worked @hamid-zp
In Ubuntu, this works for me:
sudo apt install libcairo2-dev pkg-config python3-dev
and then:pip install pycairo
it works! awesome <3
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
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
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
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"
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!
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
For some M1 Users, brew install pkg-config
worked for me.
Hi all, I am trying to build an app using Streamlit with pycairo, but I am getting this error.
This is the default GitHub action to push the app to Azure static web app.
Can anyone help me? Thanks.
In Mac and following intructions from ChatGPT4
brew install cairo
After Cairo is successfully installed, try installing Pycairo again using pip:
pip install pycairo
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!!
In Ubuntu, this works for me:
sudo apt install libcairo2-dev pkg-config python3-dev
and then:pip install pycairo
Thank you Life saver :)
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!
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.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!