How To Install Pycairo Installer
- To use the pycairo library: import cairo. To build/install the library: python2/3 setup.py build python2/3 setup.py install. To run the tests: python2/3 setup.py test. The Python 2 version supports xpyb integration which is disabled by default. To enable, build as follows: python2 setup.py build --enable-xpyb # and for running.
- This tutorial covers how to download and install packages using pip. Pip comes with newer versions of Python, and makes installing packages a breeze.
- How To Install Pycairo Installer For Windows 7
- How To Install Pycairo Installer For Windows 10
- How To Install Pycairo Installer For Pc
The package libcairo2-dev is the latest version of the Cairo graphics library (1.10.2). Is there any way I can install version 1.8.10? I'm running 11.10, but would be interested in a general solut.
I spent hours this afternoon trying to find a straightforward tutorial for installing PyCairo on Windows.
The Cairo project itself does not maintain Windows binaries, they must be dowloaded elsehere (e.g. http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/).
The process is also complicated further apparently by the fact that MSVC is apparently not a supported compiler for PyCairo (although the source patch is simple). See this bug report:
Can anyone recommend a tutorial for installing PyCairo on Windows?
6 Answers
You should try windows binary installers from Gohlke repository for pyCairo and py2Cairo.
I never used pyCairo myself but took 4 minutes to install and get my first png example file done.
joaquinjoaquinAdding the following for completeness - joaquin's answer above provides a simpler route (and Python 3 support).
Please see the following tutorial:
(also hosted at http://hal.elte.hu/~nepusz/development/igraph/tutorial/install.html).
I asked the question above, so that I could answer it myself. Hopefully people in a similar situation in future will find this post :)
While Googling 'pycairo install windows' does give the above link, it is presented below some rather unhelpful pages, and it's also not particularly obvious that igraph documentation will be applicable.
Eventually I got as far as installing PyCairo (from the GNOME link in the question), without Cairo itself. This gave me a DLL import error when I tried to use it. Fortunately, a question relating to this error exists on StackOverflow:
This question discusses the excellent tutorial from Tamas, linked above, which is all I needed to get up and running.
I believe I have installed a copy using the pygtk all-in-one installer and I believe it did Just Work (32b, python2, mind you). They also mention the gnome URL in your post.
XTLXTLinstall pygtk all in onehttp://www.pygtk.org/downloads.htmlIt includes pygtk and all its dependencies, including pycairo
A simple tutorial:http://digitalpbk.blogspot.com.au/2012/03/installing-pygtk-pypango-and-pycairo-on.html
only 4 steps and worked like a charm.
There is another similar question in StackOverflow: PyCairo - installation on Windows
The accepted answer is simple and practical.
Although the link it provided is outdated (because the version is up now), the idea is great.
I improve that answer to make it more general:
Go to Unofficial Windows Binaries for Python Extension Packages - Pycairo
Download the
pycairo‑***.whl
file (choose a proper version for your environment).Go to the folder where you download the
.whl
file and typepip install pycairo-***.whl
. Wait a few seconds and everything would be done.
I have tested this method and it works perfectly.
Not the answer you're looking for? Browse other questions tagged pythonwindowsinstallationcairopycairo or ask your own question.
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upHave 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
Comments
commented May 10, 2017
Will you be able to install pycairo using pip? |
commented May 10, 2017
Hopefully eventually :) To make this work everywhere we will need to be able to build binary wheels for most of the wanted architectures, then upload these to pip. |
commented May 10, 2017
I've brought claiming the pycairo package up multiple times on #pypa, but didn't get a response. Either I was too annoying or they are busy with other things. (@dstufft ?) We could also use the 'cairo' name, but I fear that will lead to confusion and I'd like to avoid it. |
commented May 10, 2017
or use |
commented May 12, 2017 • edited
edited
Doesn't work for me. |
commented May 13, 2017
hm, for some reason your pip tries ot use setuptools, but pycairo uses distutils. Will have a look, thanks. |
added a commit that referenced this issue May 13, 2017
commented May 13, 2017
How To Install Pycairo Installer For Windows 7
This should work now: |
commented May 13, 2017
commented May 17, 2017
I've filed a request: https://sourceforge.net/p/pypi/support-requests/728/ |
commented May 21, 2017
New bugfix release is out: |
added discussion and removed enhancement labels Jul 14, 2017
commented Jul 19, 2017
I'm getting this error: |
commented Jul 19, 2017
There is no Windows support yet (besides mingw/msys2), you can try installing wheels from here: http://www.lfd.uci.edu/%7Egohlke/pythonlibs/#pycairo |
commented Aug 12, 2017 • edited
edited
Hi, I'm using Mac Sierra. And I've tried already installed Cairo via both fink (which has only Cairo 1.12), and then by macports (which has Cairo 1.14), so I'm not sure which file the build is failing to find. |
commented Aug 12, 2017
This is the same error as two comments up. |
commented Aug 12, 2017
You are missing pkg-config |
How To Install Pycairo Installer For Windows 10
commented Aug 12, 2017
Hi Lazka, |
commented Aug 12, 2017
Ah, sorry, missed that. pkg-config is used by pycairo for finding your cairo library location. If you use macports I think installing the package The next pycairo release should have a better error message than what you got. See #60 |
commented Aug 12, 2017
Thank you Thank you Thank you Thank you!! |
commented Oct 9, 2017
In case there's any interest, I found that it is relatively easy to build a manylinux wheel for pycairo. The build script is at https://gist.github.com/anntzer/a03230f94e6d111ba3abc737d5091b99 -- you essentially just need docker installed, the script should fetch the manylinux build image and run the wheel build. |
commented Oct 10, 2017
Thanks |
commented Oct 10, 2017
Is the pypi ownership thing still an issue ? |
commented Oct 10, 2017
Yes, no progress there. |
commented Oct 10, 2017
Will try and poke some people and see what happens. |
commented Nov 7, 2017
Thanks @stuaxo |
commented Nov 8, 2017
No probs, they really need to put a note on the sourceforge page to use that github repo! |
commented Dec 7, 2017
How To Install Pycairo Installer For Pc
commented Dec 7, 2017
@stuaxo I've added you as an owner on pypi as well, so losing access doesn't happen again. |
commented Dec 8, 2017
Fantastic work :), this re-enables the pycairo usage for all sorts of users. Great to see a new version on pypi after 7 years (!). |
commented Jan 28, 2018
I needed to |
commented Mar 13, 2018
Having trouble making this work in a (mini)conda virtual environment. Running Arch linux. I have libxcb installed, and have checked that Works fine at system level.. any ideas? |
commented Mar 13, 2018
Weird, afaik
|
commented Mar 13, 2018
Yeah - that's what I thought! Modifying I'm not sure where to start interpreting this one.. |
commented Mar 13, 2018
hm, no idea, I've never used mini/anaconda. Maybe try recreating that environment? |
commented Mar 13, 2018
Just tried on a fresh environment and it worked.. odd. Thanks for the thoughts! |
commented Mar 28, 2018
On mac, ensure the cairo package is installed ( |
commented May 24, 2018 • edited
edited
While installing pycairo as a dependency, I needed to run |
commented May 24, 2018
This will be the case - on Linux and OSX pycairo gives you bindings to the installed version of the cairo library. The docs could probably be improved, by including an install section for different operating systems. |
commented May 24, 2018
I've added some code in pygobject to produce a more helpful error message: https://gitlab.gnome.org/GNOME/pygobject/commit/71eadb88fe75bfda66d449f46cde4b1eb958e4f4 Maybe we should add something similar here. |
commented May 24, 2018 • edited
edited
Very nice :) On mac it gets tricky as there can be homebrew or macports.. (or often, when people are new and trying things you come across a system with both). I've got a really ancient script in shoebot that you can probably grab the names of the cairo packages from - |
commented Jun 6, 2018
Hi, I do have another error here: |
commented Jul 4, 2018
I just reset my Mac's python to the Homebrew latest AND also tried using a virtualenv, but no matter what I get a similar error to @DrUlysses: Hombrew virtualenv: I guess what I'm saying is it appears the pycairo install issue on Mac is not necessarily dependent on environmental issues. |
commented Jul 9, 2018
|
commented Jul 23, 2018
this is my 64-bit pc. i tried to install pycairo using msys/mingw. |
commented Jan 15, 2019
Hello all, I wanted to install pycairo but I couldn't manage to, is there anyone who knows what this error message is about?
|
commented Jan 15, 2019
Hi @alfalimawhiskey Cheers |
commented Jan 15, 2019
macOS High Sierra v10.13.6 @stuaxo |
commented Jan 16, 2019 • edited
edited
Same problem here Here's all output: Notice that |
commented Jan 16, 2019 • edited
edited
First I installed homebrew, then |
commented Jan 16, 2019
Cheers, that saved me getting the mac working, I wasn't sure if you were also using brew. |