Search code examples
pythonpython-3.xpippycairo

PyCairo Pip Install in python 3.8 on windows 10 is failing


I know a lot of threads have been made about this but none of them have solved my problem. I'm trying to install Cairo through pip install. I am using the command prompt. Here's the error message:

C:\python38\Scripts>pip install cairo
ERROR: Could not find a version that satisfies the requirement cairo (from versions: none)
ERROR: No matching distribution found for cairo

I was reading the dev log on github for pycairo and it looks like it says it should work for python 3.8 and windows 10, I'm not sure what to do here. I saw one person solved this by running a VM of windows 7, I'm not sure how to do that or if it would work for my situation.

I really appreciate any help you can give me, thank you.


Solution

  • pycairo is only available as a .tar.gz on pypi, so only source code. Note that in order to compile it, you will need a C compiler and the cairo library pre installed in order to use

    pip install pycairo
    

    Alternatively however, you can also just download the correct wheel file for python 3.8 from this website which will make the installation much simpler. You will not need to compile code this way, simply do

    pip install <whl file>
    

    after downloading the right one (most likely pycairo‑1.19.0‑cp38‑cp38‑win_amd64.whl)