# Fatal error: glpk.h: No such file or directory during the installation #1273

**URL:** <https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762>\
**Category:** Installation\
**Tags:** R\
**Created:** [28 February 2024 14:08 UTC](https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762 "2024-02-28T14:08:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessijessi92](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/jessijessi92/32/1040_2.png) [@jessijessi92](https://igraph.discourse.group/u/jessijessi92)\
**Post date:** [28 February 2024 14:08 UTC](https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762/1 "2024-02-28T14:08:28Z")

</div>

Hi,  
I’m trying to install igraph package in R 4.3.1 inside Centos/Red Hat 8 through install.packages(‘igraph’) but I have encountered this error:

` vendor/cigraph/src/internal/glpk_support.h:39:10:` fatal error: glpk.h: No such file or directory  
39 | #include \<glpk.h\>  
| ^ ~~~~~~~  
compilation terminated.  
make: \*\*\* [/opt/R/4.3.1/lib/R/etc/Makeconf:191: vendor/cigraph/src/community/optimal\_modularity.o] Error 1  
ERROR: compilation failed for package ‘igraph’  
`

The glpk was installed and, before the attempt of igraph installation, I also loaded the corresponding environment module through module load glpk. I think that the compiler doesn’t see the include folder of the glpk package that is present in the system. So I have tried to insert inside the C\_INCLUDE\_PATH the path to the include folder of glpk using this command:

`Sys.setenv(C_INCLUDE_PATH="/share/apps/spack/latest-2024-01-17/linux-centos8-skylake_avx512/gcc-8.4.1/glpk-4.65-p4yflusvdbtjwtt5mhqkfobr5nxubp3f/include")`

But also in this case I encountered an error that is reported below:

`ld cannot find -lglpk`

To solve this last error, I have tried to load the corresponding libglpk.so library and retry to launch install.packages(‘igraph’) but it gives the same error.

Could you have any suggestions to solve the issue?

Thank you in advance,  
Greetings

Jessica

---

<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:** [28 February 2024 14:16 UTC](https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762/2 "2024-02-28T14:16:06Z")

</div>

Try creating the file `~/.R/Makevars` and enter the relevant compiler flags. Add at least the following two lines to this file:

```auto
CPPFLAGS=-I/path/to/include/directory
LDFLAGS=-L/path/to/library/directory

```

Let me know if this worked. If it did not, be sure to post a few of the output lines just prior to the error message you already posted above, so we can see the flags that were passed to the compiler.

---

<div class="post-metadata">

**Author:** ![jessijessi92](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/jessijessi92/32/1040_2.png) [@jessijessi92](https://igraph.discourse.group/u/jessijessi92)\
**Post date:** [29 February 2024 08:26 UTC](https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762/3 "2024-02-29T08:26:47Z")

</div>

Ok, thank you. I will give you a feedback.

---

<div class="post-metadata">

**Author:** ![jessijessi92](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/jessijessi92/32/1040_2.png) [@jessijessi92](https://igraph.discourse.group/u/jessijessi92)\
**Post date:** [29 February 2024 10:10 UTC](https://igraph.discourse.group/t/fatal-error-glpk-h-no-such-file-or-directory-during-the-installation-1273/1762/4 "2024-02-29T10:10:14Z")

</div>

> [@szhorvat](#):
>
> ```auto
> CPPFLAGS=-I/path/to/include/directory
> LDFLAGS=-L/path/to/library/directory
> 
> ```

Now, it works.

Thank you very very much 🙂

Have a nice day,  
Jessica
