This chapter describes how to install the C core of igraph and its Python bindingson various operating systems.
One way is to use to call the install package from an EC2 system. There are two options to add this like you have, but you can try to install those installed Python 3 on Linux, using the same package via Python. Install the MozillaBuild environment from here: MozillaBuild; If you chose the default install path, you'll find in c:mozilla-build several batch files. Edit the one corresponding to your version of VC (or a copy of it), and modify the INCLUDE and LIB paths. You are trying to install pycairo from source on Windows, which requires a Windows C compiler. You can try the Unofficial Windows Binaries for Python Extension Packages web site. You can find the last version of pycairo (1.15.4) for Python 3.6. It is distributed as a wheel package so you should install it. Sudo apt-get install build-essential python3-dev python3-pip python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info macOS.
Which igraph is right for you?¶
igraph is primarily a library written in C. It is not a standalone program, nor it isa Python package that you can just drop on your Python path to start using it. Therefore,if you would like to exploit igraph‘s functionality in Python, you must installa few packages. Do not worry, though, there are precompiled packages for the major operatingsystems, so you will not have to compile igraph from source unless you use an esotericoperating system or you have specific requirements (i.e., adding a custom patch to igraph‘sC core). Precompiled packages are often called binary packages, while the raw source codeis usually referred to as the source package.
In general, you should almost always opt for the binary package unless a binary package is notavailable for your platform or you have some local modifications that you want to incorporateinto igraph‘s source. Installation from a binary package tells you how to install igraphfrom a precompiled binary package on various platforms. Compiling igraph from source tellsyou how to compile igraph from the source package.
Installation from a binary package¶
igraph on Windows¶
There is a Windows installer for igraph‘s Python interface on thePython Package Index.Download the one that is suitable for your Python version (currentlythere are binary packages for Python 2.4 and Python 2.5, though itmight change in the future). To test the installed package, launchyour favourite Python IDE and type the following:
The above commands run the bundled test cases to ensure that everythingis fine with your igraph installation.
Graph plotting in igraph on Windows¶
Graph plotting in igraph is implemented using a third-party packagecalled Cairo. If you want to createpublication-quality plots in igraph on Windows, you must also installCairo and its Python bindings. The Cairo project does not providepre-compiled binaries for Windows, but other projects depending onCairo do, so the preferred way to install Cairo on Windows along withits Python bindings is as follows:
- Get the latest PyCairo for Windows installer fromhttp://ftp.gnome.org/pub/gnome/binaries/win32/pycairo/1.8. Make sure yougrab the one that matches your Python version. At the time of writing,the above folder contained installers for Python 2.6 only. You mayalso try and go one level up, then down then 1.4 subfolder – these areolder versions, but they work with Python 2.5 and Python 2.6 as well.
- Install PyCairo using the installer. The installer extracts the necessaryfiles into Libsite-packagescairo within the folder where Python isinstalled. Unfortunately there are some extra DLLs which are required tomake Cairo work, so we have to get these as well.
- Head to http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ and getthe binary versions of Cairo (cairo_1.8.10-3_win32.zip at the time ofwriting), Fontconfig (fontconfig_2.8.0-2_win32.zip), Freetype(freetype_2.4.4-1_win32.zip), Expat (expat_2.0.1-1_win32.zip),libpng (libpng_1.4.3-1_win32.zip) and zlib(zlib_1.2.5-2_win32.zip). Version numbers may vary, so beadaptive! Each ZIP file will contain a bin subfolder with a DLL file init. Put the following DLLs in Libsite-packagescairo within your Pythoninstallation:
- freetype6.dll (from freetype_2.4.4-1_win32.zip)
- libcairo-2.dll (from cairo_1.8.10-3_win32.zip)
- libexpat-1.dll (from expat_2.0.1-1_win32.zip)
- libfontconfig-1.dll (from fontconfig_2.8.0-2_win32.zip)
- libpng14-14.dll (from libpng_1.4.3-1_win32.zip)
- zlib1.dll (from zlib_1.2.5-2_win32.zip).
Having done that, you can launch Python again and check if it worked:
igraph on Linux¶
igraph on RedHat Linux¶
igraph on Mac OS X¶
There is a Mac OS X installer for igraph‘s Python interface on thePython Package Indexwhich works for Intel-based Macs running OS X Leopard. The defaultPython version in Leopard is Python 2.5, so the package is compiledfor this specific version. PowerPC users should compile the packagethemselves (see Compiling igraph from source). To test theinstalled package, launch your favourite Python IDE or the defaultcommand line interpreter and type the following:
The above commands run the bundled test cases to ensure that everythingis fine with your igraph installation.
Graph plotting in igraph on Mac OS X¶
Graph plotting in igraph is implemented using a third-party packagecalled Cairo. If you want to createpublication-quality plots in igraph on Mac OS X, you must also installCairo and its Python bindings. The Cairo project does not providepre-compiled binaries for Mac OS X, but MacPortsand Fink does, so you can use them toinstall Cairo. The Cairo homepage <http://www.cairographics.org> givesyou some installation instructions. However, this is only one half of thejob, you will also need the Python bindings of Cairo from thePyCairo homepage <http://www.cairographics.org/pycairo>. At the momentthere are no precompiled PyCairo packages for Mac OS X either.
TODO: detailed compilation instructions for PyCairo
Compiling igraph from source¶

PyQt is often not installed by default. The PyQt module can be used to create desktop applications with Python. In this article you’ll learn how to install the PyQt module.

Desktop applications made with PyQt are cross platform, they will work on Microsoft Windows, Apple Mac OS X and Linux computers (including Raspberry Pi).
Related Course:Create GUI Apps with Python PyQt5
How to install PyQt5 on Windows?
To install PyQt on Windows there are a few steps you need to take.
First use the installer from the qt-project website, from qt to install PyQt.
Next you want to install a Python version 3.3 or newer. Check the box to add all of the PyQt5 extras. It’s not necessary to compile everything from source, you can install all the required packages with the installer.
On Python >= 3.6, you can also try this command:
How To Install Pycairo Install In Windows
It should work without problems.
How to install PyQt5 on Mac OS X?
On Apple Mac OS X installation is a bit simpler. The first step to take is to install the Mac OS X binary. This installs the PyQt GUI library.
But to use it from Python, you also need Python module. This is where the tool brew comes in.
You can use brew to install pyqt (in the terminal):
How to install PyQt5 on Linux?
Python is often installed by default on Linux (in nearly all of the distributions including Ubuntu). But you want to make sure to use Python 3, because of all the features and ease of use. You can verify that you have the newest Python version with the command:
On Ubuntu Linux they sometimes include two versions of python, python3 and python. In that case use Python 3.
Once you have Python ready, the next step is to install PyQt.
This isn’t hard to do if you have some Linux experience. You can install PyQt your software package manager. Which package manager to use depends on which Linux distribution you are using.
On Ubuntu Linux / Debian Linux you can use the command:
For CentOS 7 use the command:
For RPM-based systems (Redhat-based)
Pip Install Pycairo Failed
If you are new to Python PyQt, then I highly recommend this book.