3

I'm try install pycairo with pip in windows 10, but the error fired. Previously I was asked to install Microsoft Visual C ++ 14. I did the installation and now this error appeared.

This is a Windows 10, running python 3

Collecting pycairo
  Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Building wheels for collected packages: pycairo
  Building wheel for pycairo (setup.py) ... error
  Complete output from command C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\pycairo\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-wheel-jo00janc --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\cairo
  copying cairo\__init__.py -> build\lib.win-amd64-3.7\cairo
  copying cairo\__init__.pyi -> build\lib.win-amd64-3.7\cairo
  copying cairo\py.typed -> build\lib.win-amd64-3.7\cairo
  running build_ext
  building 'cairo._cairo' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\cairo
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=1 -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tccairo/device.c /Fobuild\temp.win-amd64-3.7\Release\cairo/device.obj
  device.c
  c:\users\guilherme.angelico\appdata\local\temp\pip-install-fhxd8wdu\pycairo\cairo\pycairo.h(37): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for pycairo
  Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
  Running setup.py install for pycairo ... error
    Complete output from command C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\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 C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-record-v8fcbbie\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\cairo
    copying cairo\__init__.py -> build\lib.win-amd64-3.7\cairo
    copying cairo\__init__.pyi -> build\lib.win-amd64-3.7\cairo
    copying cairo\py.typed -> build\lib.win-amd64-3.7\cairo
    running build_ext
    building 'cairo._cairo' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\cairo
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=1 -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include -IC:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tccairo/device.c /Fobuild\temp.win-amd64-3.7\Release\cairo/device.obj
    device.c
    c:\users\guilherme.angelico\appdata\local\temp\pip-install-fhxd8wdu\pycairo\cairo\pycairo.h(37): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Users\guilherme.angelico\AppData\Local\Continuum\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\GUILHE~1.ANG\\AppData\\Local\\Temp\\pip-install-fhxd8wdu\\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 C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-record-v8fcbbie\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\GUILHE~1.ANG\AppData\Local\Temp\pip-install-fhxd8wdu\pycairo\

2

1 Answer 1

4

I had same error. Found .whl on below Link: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo

Get the one for your version.

Download from above link and run command similar to below: pip install pycairo-1.18.1-cp37-cp37m-win_amd64.whl

1
  • I did it like you say, but then when installing my project he keeps asking for the version 1.18.0 and the only available is 1.18.1. How can I change the version needed in the project? Commented Jun 14, 2019 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.