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

error related to install pycairo #2

Open
amiltonwong opened this issue Feb 2, 2021 · 6 comments
Open

error related to install pycairo #2

amiltonwong opened this issue Feb 2, 2021 · 6 comments

Comments

@amiltonwong
Copy link

Hi, @gordicaleksa,

Thanks for providing such great tutorial. I came across pycairo error when building the virtual env based on the provided environment.yml. The error is as follows:

Pip subprocess error:
  ERROR: Command errored out with exit status 1:
   command: /root/anaconda3/envs/pytorch-gat/bin/python /root/anaconda3/envs/pytorch-gat/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp1xff5oe8
       cwd: /tmp/pip-install-kkpb3rbl/pycairo_24f3dd5c18ec42d9854417db277fda61
  Complete output (15 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
  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.15.10']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly

Any hints to solve this issue?

(My system is ubuntu 16.04)

Thanks!

@amiltonwong
Copy link
Author

Supplement:

Even though I install pycairo under google colab environment, I still cannot install it properly
!pip install pycairo==1.20.0

Collecting pycairo==1.20.0
  Downloading https://files.pythonhosted.org/packages/9d/6e/499d6a6db416eb3cdf0e57762a269908e4ab6638a75a90972afc34885b91/pycairo-1.20.0.tar.gz (344kB)
     |████████████████████████████████| 348kB 15.3MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pycairo
  Building wheel for pycairo (PEP 517) ... error
  ERROR: Failed building wheel for pycairo
  Running setup.py clean for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly

@gordicaleksa
Copy link
Owner

Hey!

Hm, interesting Tamas one of the coauthors of igraph develops all of these tools for Linux, actually, Windows users are usually second-class citizens having problems with igraph.

I had problems setting up igraph in my conda env (note I'm on Windows).
This initially solved the problem for me (for future Windows users looking at this thread):

  1. Download appropriate wheels (see 2)) from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/
  2. pip install pycairo-1.20.0-cp38-cp38-win_amd64.whl
    pip install python_igraph-0.8.3-cp38-cp38-win_amd64.wh

But later I found the combination that works, now included inside the env yaml file:

  • python-igraph==0.8.3
  • pycairo==1.20.0

This SO link also helped: https://stackoverflow.com/questions/48131876/installation-of-pycairo-on-windows

My first advice is, try uninstalling and installing packages from scratch.
The second advice use conda envs instead of virtualenv.

Hope this somewhat helps.

@wrosko
Copy link

wrosko commented Feb 14, 2021

I'm currently running Ubuntu 20.04 and was getting the pycairo PEP error as well. What I ended up doing to get things working was:

  • First head to the pycairo docs page and then clone the Github repo

  • cd to the library then try to build the package while in the pytorch-gat env with python setup.py build and then python setup.py install (these were found on the pycairo docs page`)

  • If package fails because you're missing cairo simply do the relevant things to get it on your system from the cairo webpage, then retry the python build of the package

  • Run the tests to make sure package works (might need to pip install pytest: python setup.py test

@amiltonwong and @jamool2012 a potential solution for you. @gordicaleksa you might want to highlight this or I can do a PR on the docs/home page

@decoherencer
Copy link

also these can help if one is starting on fresh instance.
sudo apt install build-essential libcairo2-dev pkg-config python3-dev

@Kamleecoder
Copy link

I'm currently running Ubuntu 20.04 and was getting the pycairo PEP error as well. What I ended up doing to get things working was:

  • First head to the pycairo docs page and then clone the Github repo
  • cd to the library then try to build the package while in the pytorch-gat env with python setup.py build and then python setup.py install (these were found on the pycairo docs page`)
  • If package fails because you're missing cairo simply do the relevant things to get it on your system from the cairo webpage, then retry the python build of the package
  • Run the tests to make sure package works (might need to pip install pytest: python setup.py test

@amiltonwong and @jamool2012 a potential solution for you. @gordicaleksa you might want to highlight this or I can do a PR on the docs/home page

I solved my problem by sudo apt-get install libcairo2-dev

@ichsan2895
Copy link

ichsan2895 commented Nov 19, 2023

I'm currently running Ubuntu 20.04 and was getting the pycairo PEP error as well. What I ended up doing to get things working was:

  • First head to the pycairo docs page and then clone the Github repo
  • cd to the library then try to build the package while in the pytorch-gat env with python setup.py build and then python setup.py install (these were found on the pycairo docs page`)
  • If package fails because you're missing cairo simply do the relevant things to get it on your system from the cairo webpage, then retry the python build of the package
  • Run the tests to make sure package works (might need to pip install pytest: python setup.py test

@amiltonwong and @jamool2012 a potential solution for you. @gordicaleksa you might want to highlight this or I can do a PR on the docs/home page

I solved my problem by sudo apt-get install libcairo2-dev

Thank you!
It works for me too by installing apt-get install libcairo2-dev.

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

No branches or pull requests

6 participants