Cannot compile R igraph 1.4.1 despite all satisfied dependencie

Dear all,

I followed the GitHub instrusctions and installed all the necessary dependencies on Linux Mint 21.1 (same as Ubuntu), i.e. build-essential, gfortran, g++, libxml2-dev, libglpk-dev. However, it fails with this strange error message:

R CMD INSTALL igraph_1.4.1.tar.gz 
* installing to library ‘/home/fifis/R/x86_64-pc-linux-gnu-library/4.2’
* installing *source* package ‘igraph’ ...
** package ‘igraph’ successfully unpacked and MD5 sums checked
** using staged installation
/usr/local/lib/R/bin/Rcmd: 64: exec: config: not found
/usr/local/lib/R/bin/Rcmd: 64: exec: config: not found
configure: error: No C++11 compiler is available
ERROR: configuration failed for package ‘igraph’
* removing ‘/home/fifis/R/x86_64-pc-linux-gnu-library/4.2/igraph’

I compiled R from source and had no such error message.The file /usr/local/lib/R/bin/Rcmd is in place, and on its 64th line, it says
exec "${cmd}" ${extra} "${@}".

Diagnostic info:

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 21.1

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
 [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ks_1.14.0

loaded via a namespace (and not attached):
 [1] microbenchmark_1.4.9 compiler_4.2.2       Matrix_1.5-3         mclust_6.0.0         plot3D_1.4          
 [6] parallel_4.2.2       tools_4.2.2          misc3d_0.9-1         mvtnorm_1.1-3        KernSmooth_2.23-20  
[11] grid_4.2.2           pracma_2.4.2         lattice_0.20-45      tcltk_4.2.2  

System information:

uname -a
Linux GF72-8RD 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

Is igraph calling the configure script in some non-standard manner? Which thing should I be trying to locate with which for further diagnostics?

Thank you in advance for a working solution / suggestion what might be missing on my system.

What does R CMD config CXX11 output on your system?

I think I might have a similar problem. I’m trying to build igraph for my docker image that is based on
jupyter/datascience-notebook:2023-10-20

My Dockerfile contains (among lots of other lines)

FROM jupyter/datascience-notebook:2023-10-20
...
RUN apt-get -y install build-essential
...
RUN apt install -y build-essential gfortran
RUN apt-get -y install libglpk-dev libgmp-dev libxml2-dev
RUN Rscript -e 'install.packages("igraph", repos="http://cran.us.r-project.org/")'

And the error that I get is about the missing glpk.h

In file included from vendor/cigraph/src/community/optimal_modularity.c:32:
vendor/cigraph/src/internal/glpk_support.h:39:10: fatal error: glpk.h: No such file or directory
   39 | #include <glpk.h>
      |          ^~~~~~~~
compilation terminated.

The output to

RUN R CMD config CXX11

is

x86_64-conda-linux-gnu-c++

You are trying to install igraph while a conda environment is active, please see this answer in this other topic: R Igraph 2.0.1.1 installation fails on ubuntu 20.04.06 desktop - #4 by szhorvat

1 Like

Hmm, seemingly not:

Step 70/71 : RUN conda deactivate
—> Running in c0a305483401
usage: conda [-h] [-v] [–no-plugins] [-V] COMMAND …
conda: error: argument COMMAND: invalid choice: ‘deactivate’ (choose from ‘clean’, ‘compare’, ‘config’, ‘create’, ‘info’, ‘init’, ‘install’, ‘list’, ‘notices’, ‘package’, ‘remove’, ‘uninstall’, ‘rename’, ‘run’, ‘search’, ‘update’, ‘upgrade’, ‘doctor’, ‘env’)
The command ‘/bin/bash -o pipefail -c conda deactivate’ returned a non-zero code: 2

Not sure, perhaps it is not activated anymore/not yet at they particular step?

Above, the output you mention:

points to a conda compiler, which should usually only be used when a conda environment is activated.

hm, interesting… I’ve tried

Step 68/73 : RUN R CMD config CXX11
—> Running in 7f8bfbf7c875
x86_64-conda-linux-gnu-c++
Removing intermediate container 7f8bfbf7c875
—> 3058f7b16646
Step 69/73 : RUN conda deactivate
—> Running in 2bfdbdde6cb1
usage: conda [-h] [-v] [–no-plugins] [-V] COMMAND …
conda: error: argument COMMAND: invalid choice: ‘deactivate’ (choose from ‘clean’, ‘compare’, ‘config’, ‘create’, ‘info’, ‘init’, ‘install’, ‘list’, ‘notices’, ‘package’, ‘remove’, ‘uninstall’, ‘rename’, ‘run’, ‘search’, ‘update’, ‘upgrade’, ‘doctor’, ‘env’)
The command ‘/bin/bash -o pipefail -c conda deactivate’ returned a non-zero code: 2

With very old versions of conda one had to do source deactivate instead, as I recall …

also didn’t work…

Step 69/73 : RUN R CMD config CXX11
—> Running in ffeb62de6133
x86_64-conda-linux-gnu-c++
Removing intermediate container ffeb62de6133
—> f929b3ae14d7
Step 70/73 : RUN source deactivate
—> Running in 7ca4d5e2dd5f
DeprecationWarning: ‘source deactivate’ is deprecated. Use ‘conda deactivate’.
Removing intermediate container 7ca4d5e2dd5f
—> bf61f41ea3ea
Step 71/73 : RUN R CMD config CXX11
—> Running in f070a457dce1
x86_64-conda-linux-gnu-c++
Removing intermediate container f070a457dce1
—> b5ee67373409
Step 72/73 : RUN conda deactivate
—> Running in 8457da3657c1
usage: conda [-h] [-v] [–no-plugins] [-V] COMMAND …
conda: error: argument COMMAND: invalid choice: ‘deactivate’ (choose from ‘clean’, ‘compare’, ‘config’, ‘create’, ‘info’, ‘init’, ‘install’, ‘list’, ‘notices’, ‘package’, ‘remove’, ‘uninstall’, ‘rename’, ‘run’, ‘search’, ‘update’, ‘upgrade’, ‘doctor’, ‘env’)
The command ‘/bin/bash -o pipefail -c conda deactivate’ returned a non-zero code: 2

Then I tried to move these commands near the top of my script

FROM jupyter/datascience-notebook:2023-10-20
RUN apt-get update
RUN apt-get -y install build-essential
RUN apt-get -y install python3-dev
RUN apt update
RUN R CMD config CXX11
RUN apt-get install -y gfortran
RUN apt-get -y install libglpk-dev libgmp-dev libxml2-dev
RUN Rscript -e ‘install.packages(“igraph”, repos=“http://cran.us.r-project.org/”)’

I already get

x86_64-conda-linux-gnu-c++

I guess that means that

FROM jupyter/datascience-notebook:2023-10-20

already comes with a conda compiled R?

If so, I suggest you install igraph from conda as well. The package name is r-igraph.

Just reporting back, it worked!

I used

RUN conda install r-igraph

in my Dockerfile

Thanks for your help!