# R installation fails on Ubuntu 22.04

**URL:** <https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467>\
**Category:** Installation\
**Tags:** R\
**Created:** [10 February 2023 19:47 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467 "2023-02-10T19:47:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbridgesds](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@rbridgesds](https://igraph.discourse.group/u/rbridgesds)\
**Post date:** [10 February 2023 19:47 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/1 "2023-02-10T19:47:29Z")

</div>

This is the error message I get when the installation exits:

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, …):  
unable to load shared object ‘/home/richard/R/x86\_64-pc-linux-gnu-library/4.2/00LOCK-igraph/00new/igraph/libs/igraph.so’:  
libmkl\_rt.so.1: cannot open shared object file: No such file or directory  
Error: loading failed  
Execution halted  
ERROR: loading failed

- removing ‘/home/richard/R/x86\_64-pc-linux-gnu-library/4.2/igraph’
- restoring previous ‘/home/richard/R/x86\_64-pc-linux-gnu-library/4.2/igraph’  
Warning in install.packages :  
installation of package ‘igraph’ had non-zero exit status

Any help would be appreciated.

Thanks,

Richard

---

<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:** [11 February 2023 22:35 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/2 "2023-02-11T22:35:48Z")

</div>

Do you have Anaconda installed? If so, deactivate any conda environments before compiling any software, including igraph.

Please see here:

> **[Installation Troubleshooting](https://github.com/igraph/rigraph/wiki/Installation-Troubleshooting#libgfortranso4-cannot-open-shared-object-file-no-such-file-or-directory)**
>
> igraph R package. Contribute to igraph/rigraph development by creating an account on GitHub.

If you don’t have Anaconda installed, can you identify why you have MKL binaries in your path?

---

<div class="post-metadata">

**Author:** ![rbridgesds](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@rbridgesds](https://igraph.discourse.group/u/rbridgesds)\
**Post date:** [12 February 2023 19:23 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/3 "2023-02-12T19:23:43Z")

</div>

I do have miniconda installed. I deactivated conda in the R Studio terminal, then tried install.packages(“igraph”) in the R studio console. I was given the same error message. Was this the proper course of action to take?

---

<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 February 2023 20:49 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/4 "2023-02-12T20:49:44Z")

</div>

I suggest trying the following in a newly opened terminal (not in RStudio):

- Run `conda deactivate`
- Make sure Anaconda’s `bin` directory is not in your `PATH`. Only `condabin` should be in your path, not `bin`. See here for more details: [Installation Troubleshooting · igraph/rigraph Wiki · GitHub](https://github.com/igraph/rigraph/wiki/Installation-Troubleshooting#libgfortranso4-cannot-open-shared-object-file-no-such-file-or-directory)
- Start `R` within the same terminal
- Run `install.packages('igraph')`

Let us know if this worked.

---

<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 February 2023 20:53 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/5 "2023-02-12T20:53:30Z")

</div>

> [@rbridgesds](#):
>
> I deactivated conda in the R Studio terminal,

Note that this likely won’t have any effect on your R session. It only affects that one terminal window, but not the R console within RStudio. This is why above I suggested not using RStudio at all.

---

<div class="post-metadata">

**Author:** ![rbridgesds](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@rbridgesds](https://igraph.discourse.group/u/rbridgesds)\
**Post date:** [12 February 2023 23:27 UTC](https://igraph.discourse.group/t/r-installation-fails-on-ubuntu-22-04/1467/6 "2023-02-12T23:27:46Z")

</div>

It installed successfully. Thank you so much for the help.
