# Cannot compile R igraph 1.4.1 despite all satisfied dependencie

**URL:** <https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495>\
**Category:** Installation\
**Tags:** R\
**Created:** [9 March 2023 14:10 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495 "2023-03-09T14:10:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fifis](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/fifis/32/907_2.png) [@Fifis](https://igraph.discourse.group/u/Fifis)\
**Post date:** [9 March 2023 14:10 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/1 "2023-03-09T14:10:28Z")

</div>

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:

```auto
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:

```auto
> 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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [9 March 2023 20:58 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/2 "2023-03-09T20:58:14Z")

</div>

What does `R CMD config CXX11` output on your system?

---

<div class="post-metadata">

**Author:** ![Celine](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/celine/32/1035_2.png) [@Celine](https://igraph.discourse.group/u/Celine)\
**Post date:** [8 February 2024 13:54 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/3 "2024-02-08T13:54:08Z")

</div>

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)

```auto
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

```auto
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++

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [8 February 2024 14:17 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/4 "2024-02-08T14:17:19Z")

</div>

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](https://igraph.discourse.group/t/r-igraph-2-0-1-1-installation-fails-on-ubuntu-20-04-06-desktop/1740/4)

---

<div class="post-metadata">

**Author:** ![Celine](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/celine/32/1035_2.png) [@Celine](https://igraph.discourse.group/u/Celine)\
**Post date:** [8 February 2024 14:33 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/5 "2024-02-08T14:33:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [8 February 2024 14:50 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/6 "2024-02-08T14:50:30Z")

</div>

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

Above, the output you mention:

> [@Celine](#):
>
> > x86\_64-conda-linux-gnu-c++

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

---

<div class="post-metadata">

**Author:** ![Celine](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/celine/32/1035_2.png) [@Celine](https://igraph.discourse.group/u/Celine)\
**Post date:** [8 February 2024 14:59 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/7 "2024-02-08T14:59:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [8 February 2024 15:29 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/8 "2024-02-08T15:29:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Celine](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/celine/32/1035_2.png) [@Celine](https://igraph.discourse.group/u/Celine)\
**Post date:** [8 February 2024 16:02 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/9 "2024-02-08T16:02:48Z")

</div>

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/](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?

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [8 February 2024 19:46 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/10 "2024-02-08T19:46:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Celine](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/celine/32/1035_2.png) [@Celine](https://igraph.discourse.group/u/Celine)\
**Post date:** [10 February 2024 00:13 UTC](https://igraph.discourse.group/t/cannot-compile-r-igraph-1-4-1-despite-all-satisfied-dependencie/1495/11 "2024-02-10T00:13:29Z")

</div>

Just reporting back, it worked!

I used

> RUN conda install r-igraph

in my Dockerfile

Thanks for your help!
