Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No package 'cairo' found #89

Closed
fernandog opened this issue Jan 11, 2018 · 33 comments
Closed

No package 'cairo' found #89

fernandog opened this issue Jan 11, 2018 · 33 comments
Labels

Comments

@fernandog
Copy link

fernandog commented Jan 11, 2018

How to fix this please?

Linux-4.9.29-13-osmc-armv7l-with-debian-9.3
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2

Collecting pygobject
  Using cached PyGObject-3.27.1.tar.gz
Collecting pycairo>=1.11.1 (from pygobject)
  Using cached pycairo-1.15.4.tar.gz
Installing collected packages: pycairo, pygobject
  Running setup.py install for pycairo ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-aNZaJA/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 /tmp/pip-nItI09-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-2.7
    creating build/lib.linux-armv7l-2.7/cairo
    copying cairo/__init__.py -> build/lib.linux-armv7l-2.7/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-aNZaJA/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 /tmp/pip-nItI09-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-aNZaJA/pycairo/

@lazka
Copy link
Member

lazka commented Jan 11, 2018

sudo apt install libcairo2-dev

@lazka lazka added the needinfo label Jan 11, 2018
@fernandog
Copy link
Author

fernandog commented Jan 11, 2018

now:
Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-introspection-1.0' found

@lazka
Copy link
Member

lazka commented Jan 11, 2018

sudo apt install libgirepository1.0-dev

@fernandog
Copy link
Author

worked. thanks.
Why needed to manually installed those?

@lazka
Copy link
Member

lazka commented Jan 11, 2018

They are not Python packages, and there is as far as I know, no standard way to deal with those.

But maybe we can print a nicer error message if one is on a Debian based system.

@lazka lazka closed this as completed Jan 13, 2018
@vinaysimhabn
Copy link

hi,

i am trying to get python package pygobject, pycairo as snap, but the build is failing , please suggest

https://git.launchpad.net/ifc6309/tree/snap/snapcraft.yaml?h=6309&id=7eb692ef41c3c6111c691db0f5911508c547ccbe

failed build log
https://launchpadlibrarian.net/372440779/buildlog_snap_ubuntu_xenial_arm64_serial_BUILDING.txt.gz

ext.include_dirs += [get_pycairo_include_dir()]
File "/tmp/pip-wheel-qivugl0u/pygobject/setup.py", line 582, in get_pycairo_include_dir
include_dir = find_path(find_new_api())
File "/tmp/pip-wheel-qivugl0u/pygobject/setup.py", line 532, in find_new_api
import cairo
ImportError: No module named 'cairo'

@lazka
Copy link
Member

lazka commented May 30, 2018

@vinaysimhabn I haven't used snapcraft yet, but have you tried adding "pycairo" to "python-packages" list?

@vinaysimhabn
Copy link

i have tried pycairo to python-packages, even that also fails saying "ImportError: No module named 'cairo'.

@vinaysimhabn
Copy link

hi,
earlier i was building in x86, it was failing for pycairo and pygobject.
now i am building in arm64, i am able to build the pycairo, but not able to build the pygobject. please suggest

failed build-log : https://launchpadlibrarian.net/372548639/buildlog_snap_ubuntu_xenial_arm64_pygobject_BUILDING.txt.gz

snapcraft.yaml
https://git.launchpad.net/ifc6309/tree/snapcraft.yaml?h=6309&id=486bbc591a8b09a374656c0d311a21be5a2308b2

@lazka
Copy link
Member

lazka commented May 31, 2018

Untested:

parts:
  pycairo:
    source: https://github.com/pygobject/pycairo/releases/download/v1.17.0/pycairo-1.17.0.tar.gz
    plugin: python
    build-packages:
      - libcairo2-dev
    stage-packages:
      - libcairo2
  pygobject:
    source: https://download.gnome.org/sources/pygobject/3.28/pygobject-3.28.2.tar.xz
    plugin: python
    after:
      - pycairo
    build-packages:
      - libglib2.0-dev
      - libgirepository1.0-dev
      - libffi-dev
    stage-packages:
      - libglib2.0
      - libgirepository-1.0
      - libffi6
      - libcairo-gobject2

@vinaysimhabn
Copy link

vinaysimhabn commented May 31, 2018 via email

@vinaysimhabn
Copy link

vinaysimhabn commented Jun 1, 2018 via email

@lazka
Copy link
Member

lazka commented Jun 1, 2018

ImportError: cannot import name GObject, introspection typelib not found

This means you are missing "gir1.2-glib-2.0"

@vinaysimhabn
Copy link

vinaysimhabn commented Jun 1, 2018 via email

@tripperyoung
Copy link

Please help me with this
screen shot 2018-09-26 at 18 08 10

@cleebp
Copy link

cleebp commented Oct 19, 2018

For Mac users simply brew install cairo before pip installing and it should work fine.

@ianfowler
Copy link

ianfowler commented Nov 4, 2019

@cleebp pip installing after a successful brew install resulted in the following:

ERROR: Could not find a version that satisfies the requirement cairo (from versions: none)
ERROR: No matching distribution found for cairo

Did you mean pip installing something else?

@peratik
Copy link

peratik commented Dec 19, 2019

sudo apt install libcairo2-dev

@petervandenabeele
Copy link

As suggested above, is there any systematic way of doing:

  • if on Debian/Ubuntu or on Mac
  • test that required dev packages are installed
  • if not => print out a clear hint with
# the build will probably fail, you probably need to execute
sudo apt install libcairo2-dev libgirepository1.0-dev

or

# the build will probably fail, you probably need to execute
brew install cairo ...

Adding this, would make the installation a lot more user friendly :-)

Anyway, works for me now, thanks for everything :-D

@lazka
Copy link
Member

lazka commented Feb 4, 2020

Adding this, would make the installation a lot more user friendly :-)

I've opened #175

@Saamy88
Copy link

Saamy88 commented Mar 4, 2020

What about for CentOS7?

@tnt4brain
Copy link

What about for CentOS7?
Looks like you should install three packages (on a fresh CentOS box):

  1. python-devel
  2. gobject-introspection-devel
  3. cairo-gobject-devel

These three packages will bring you all the stuff you need, so "pip install PyGObject" could proceed without glithces.

@Shahar-Ben-Ezra
Copy link

$ sudo apt-get update
$ sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

https://github.com/Automattic/node-canvas/wiki/Installation:-Ubuntu-and-other-Debian-based-systems

@bitnom
Copy link

bitnom commented Oct 21, 2020

use direnv or just add to your profile/rc:

export PKG_CONFIG_PATH="/usr/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"

@SakurajimaMaii
Copy link

sudo apt install libcairo2-dev

Useful solution

@AvinandanPal25
Copy link

AvinandanPal25 commented Dec 2, 2022

"sudo apt install libcairo2-dev" seemed to be the answer.

But can anyone guide me on how to do it on windows cmd.

I'm getting this error if I run the above command.
sudo : The term 'sudo' is not recognized as the name of a cmdlet, function, script file, or operable program.
I really need the solution. Thank you.

@danyeaw
Copy link
Contributor

danyeaw commented Dec 12, 2022

@AvinandanPal25 You can either build cairo and pycairo using gvsbuild or install msys2 and install the right packages (mingw-w64-x86_64-cairo, mingw-w64-x86_64-python-pip, etc)

@stories2
Copy link

use direnv or just add to your profile/rc:

export PKG_CONFIG_PATH="/usr/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"

It works for me. Ty

@Chit0mx
Copy link

Chit0mx commented May 10, 2023

For Mac users simply brew install cairo before pip installing and it should work fine.

This works fine for me.

@albert-a
Copy link

Hello,
I installed fresh LXC contained with Debian 12 on Proxmox 8, installed lxqt and xrdp:

apt install lxqt-core xrdp
adduser xrdp ssl-cert
reboot

I have added a user and can successfully login as my user using remote desktop client. Everything works except lxqt-globalkeysd, when I launch it manually in the terminal app, I get the following error:

$ lxqt-globalkeysd
[Critical] Cannot register service 'org.lxqt.global_key_shortcuts'
[Notice] Stopped

@MarkHoo
Copy link

MarkHoo commented Jan 25, 2024

For Mac users simply brew install cairo before pip installing and it should work fine.

This works fine for me.

Hello, my system is macOS10.15, and the same error occurred above, but the installation failed using this command. How should I solve it?

@MarkHoo
Copy link

MarkHoo commented Jan 25, 2024

For Mac users simply brew install cairo before pip installing and it should work fine.

My system is macOS10.15, and the same error occurred above, but the installation failed using this command. How should I solve it?

@stuaxo
Copy link
Collaborator

stuaxo commented Jan 26, 2024

If you use homebrew to install cairo, then when you use pycairo it should probably be from python installed by homebrew as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests