pytorch-GAT icon indicating copy to clipboard operation
pytorch-GAT copied to clipboard

error related to install pycairo

Open amiltonwong opened this issue 3 years ago • 6 comments

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 avatar Feb 02 '21 12:02 amiltonwong

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

amiltonwong avatar Feb 03 '21 01:02 amiltonwong

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.

gordicaleksa avatar Feb 04 '21 09:02 gordicaleksa

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

wrosko avatar Feb 14 '21 23:02 wrosko

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

decoherencer avatar Apr 30 '21 09:04 decoherencer

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

Kamleecoder avatar Aug 23 '21 07:08 Kamleecoder

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.

ichsan2895 avatar Nov 19 '23 04:11 ichsan2895