Skip to content

Installation Troubleshooting

Szabolcs Horvát edited this page Oct 7, 2022 · 20 revisions

This page details common problems encountered when trying to install igraph. If you did not find an answer to your problem here, feel free to ask for help on https://igraph.discourse.group/

Cannot compile igraph from sources on Windows or macOS

Do not compile igraph from sources, unless you know what you are doing! It is much more convenient to use the binaries from CRAN instead. These can be installed using install.packages("igraph").

Usually, it takes a few days for binary releases to become available on CRAN after each new igraph source release. During this period, install.packages() will give you a choice about using the latest source release or the previous binary release. Just choose to use the binary release, i.e. respond "no" to "Do you want to install from sources?"

> install.packages('igraph')

  There is a binary version available but the source
  version is later:
       binary source needs_compilation
igraph  1.2.7  1.2.8              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no

CRAN provides Windows and macOS binaries only for the last two minor releases of R (for example 4.2 and 4.1). Check what the latest R version is at https://www.r-project.org/ and make sure you are using it.

Note that the pre-compiled binaries on CRAN are only compatible with the R distribution provided by CRAN itself. If you obtained R from different sources, such as Homebrew or MacPorts on macOS, you will not be able to use these, and the only way to install packages will be to compile them from sources.

I still want to compile igraph from sources

If you decide to try to compile from sources anyway, basic requirements are listed below. It is assumed that you are comfortable compiling software from sources and resolving basic issues as they arise. Otherwise, please use the binaries.

  • Make sure you have a compatible toolchain installed, including a Fortran compiler. On Linux, make sure you have gfortran installed. For Windows, see https://cran.r-project.org/bin/windows/Rtools/
  • Make sure you have the GLPK C library installed. This is not the same as the Rglpk R package. Instructions for installing libraries for Rtools4 on Windows are here, see in particular the "Using pacman" link. You will find a copyable pacman command for installing all dependencies here.

Cannot compile igraph from sources on Linux

On Linux, the only way to install igraph is to compile it from sources. In order to do so, make sure that you have all the prerequisites:

  • C, C++ and Fortran compilers. On Debian-based distros, use sudo apt install build-essential gfortran.
  • Development packages for libxml2 and glpk. On Debian-based distros, use sudo apt install libxml2-dev libglpk-dev.

The most common issues while compiling igraph on Linux are detailed below.

libgfortran.so.4: cannot open shared object file: No such file or directory

This problem occurs when there are multiple incompatible gfortran versions on your machine. Most commonly, one of them comes from an active Anaconda environment. Always deactivate all Anaconda environments using conda deactivate before installing igraph.

Clone this wiki locally