# Installing igraph for R fails: "fatal error: glpk.h: No such file or directory"

**URL:** <https://igraph.discourse.group/t/installing-igraph-for-r-fails-fatal-error-glpk-h-no-such-file-or-directory/963>\
**Category:** Installation\
**Tags:** R\
**Created:** [12 November 2021 04:11 UTC](https://igraph.discourse.group/t/installing-igraph-for-r-fails-fatal-error-glpk-h-no-such-file-or-directory/963 "2021-11-12T04:11:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rangaraj-baskar](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/rangaraj-baskar/32/624_2.png) [@Rangaraj-baskar](https://igraph.discourse.group/u/Rangaraj-baskar)\
**Post date:** [12 November 2021 04:11 UTC](https://igraph.discourse.group/t/installing-igraph-for-r-fails-fatal-error-glpk-h-no-such-file-or-directory/963/1 "2021-11-12T04:11:37Z")

</div>

```auto
/mingw32/bin/gcc -I"R:/PSG Files/Semester 5/Statistics for Engineers/R-4.1.1/include" -DNDEBUG -I/mingw32/include/libxml2 -I/mingw32/include -DLIBXML_STATIC -DUSING_R -DHAVE_FMEMOPEN=0 -DHAVE_OPEN_MEMSTREAM=0 -DHAVE_RINTF -DWin32 -DHAVE_LIBXML -DHAVE_UNISTD_H -Wall -DPACKAGE_VERSION=\"1.2.8\" -DHAVE_FMIN=1 -DHAVE_LOG2=1 -DHAVE_SNPRINTF -Ics -I/mingw32/include -DHAVE_GLPK=1 -Iplfit -Iprpack -DIGRAPH_THREAD_LOCAL= -DPRPACK_IGRAPH_SUPPORT -I. -Iinclude -ISuiteSparse_config -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -I/mingw32/include -DINTERNAL_SUITESPARSE -DINTERNAL_ARPACK -I. -I/mingw32/include -DHAVE_GFORTRAN -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c feedback_arc_set.c -o feedback_arc_set.o
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.
make: *** [R:/PSG Files/Semester 5/Statistics for Engineers/R-4.1.1/etc/i386/Makeconf:238: feedback_arc_set.o] Error 1
ERROR: compilation failed for package 'igraph'
* removing 'R:/PSG Files/Semester 5/Statistics for Engineers/R-4.1.1/library/igraph'
* restoring previous 'R:/PSG Files/Semester 5/Statistics for Engineers/R-4.1.1/library/igraph'
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\ranga\AppData\Local\Temp\Rtmp48RMAU\downloaded_packages’

```

Can someone help me with this issue ?

---

<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:** [12 November 2021 07:11 UTC](https://igraph.discourse.group/t/installing-igraph-for-r-fails-fatal-error-glpk-h-no-such-file-or-directory/963/2 "2021-11-12T07:11:02Z")

</div>

**Update:** The solution is now described here:

> <https://github.com/igraph/rigraph/issues/490>
>
> 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?

* * *

Please see what I wrote [here](https://github.com/igraph/rigraph/issues/489#issuecomment-964337011).

We recommend that you wait for the binary release. You can use 1.2.7 until a binary becomes available for 1.2.8.

If you still want to compile it from source, you need to install GLPK in such a way that it becomes available to your compiler. If you are using Rtools4, the documentation is here: [Using Rtools4 on Windows](https://cran.r-project.org/bin/windows/Rtools/) See “Using pacman” for how to install libraries such as GLPK.

---

<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:** [12 November 2021 07:55 UTC](https://igraph.discourse.group/t/installing-igraph-for-r-fails-fatal-error-glpk-h-no-such-file-or-directory/963/3 "2021-11-12T07:55:27Z")

</div>


