Skip to content

Installation Troubleshooting

Szabolcs Horvát edited this page Sep 15, 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/

Missing glpk.h

Q: I am trying to install igraph from CRAN with install.packages("igraph"), and I get an error like this:

In file included from feedback_arc_set.c:31:
igraph_glpk_support.h:36:10: fatal error: glpk.h: No such file or directory
 #include <glpk.h>
          ^~~~~~~~
compilation terminated.

How do I solve this?

A:

On Windows and macOS, use the binary release

This error occurs when: (1) trying to compile igraph from source and (2) the GLPK C library is not installed. We strongly recommend not to try to compile igraph yourself on Windows or macOS. Use the binary releases instead.

Usually, it takes a few days for binary releases to become available on CRAN after each new 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

After a few days, the latest release will become available as a binary. Then you can upgrade.

Compiling from source

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.

Clone this wiki locally