Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find libmkl-rt.so.1 to install #477

Closed
dn-ra opened this issue Sep 22, 2021 · 11 comments
Closed

Can't find libmkl-rt.so.1 to install #477

dn-ra opened this issue Sep 22, 2021 · 11 comments

Comments

@dn-ra
Copy link

dn-ra commented Sep 22, 2021

I'm trying to install igraph, repeatedly failing as it can't find shared mkl library.

I installed the library with apt-get, but it doesn't include libmkl-rt.so.1, only libmkl-rt.so

I found the .so.1 file in my miniconda installation, and linked to there with export $LD_LIBRARY_PATH=/home/daniel/miniconda/lib:/usr/lib, but it still is failing to install with the following error

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/daniel/R/x86_64-pc-linux-gnu-library/4.1/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/daniel/R/x86_64-pc-linux-gnu-library/4.1/igraph'

Any ideas?

Using R-4.1.1 in Ubuntu 20.04
Here is the relevant parts of the environment:

Sys.getenv()
R_CHECK_COMPILATION_FLAGS_KNOWN -Wformat -Werror=format-security -Wdate-time
CLICOLOR_FORCE 1
DISPLAY :0
EDITOR vi
GIT_ASKPASS rpostback-askpass
HOME /home/daniel
LANG C.UTF-8
LD_LIBRARY_PATH /usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
LN_S ln -s
LOGNAME daniel
MAKE make
MPLENGINE tkAgg
PAGER /usr/bin/pager
PATH /sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/rstudio-server/bin/postback
R_BROWSER xdg-open
R_BZIPCMD /bin/bzip2
R_DOC_DIR /usr/share/R/doc
R_GZIPCMD /bin/gzip -n
R_HOME /usr/lib/R
R_INCLUDE_DIR /usr/share/R/include
R_LIBS_SITE /usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
R_LIBS_USER ~/R/x86_64-pc-linux-gnu-library/4.1
R_PAPERSIZE letter
R_PAPERSIZE_USER a4
R_PDFVIEWER /usr/bin/xdg-open
R_PLATFORM x86_64-pc-linux-gnu
R_PRINTCMD /usr/bin/lpr
R_RD4PDF times,inconsolata,hyper
R_SESSION_TMPDIR /tmp/RtmpM3Sbco
R_SHARE_DIR /usr/share/R/share
R_STRIP_SHARED_LIB strip --strip-unneeded
R_STRIP_STATIC_LIB strip --strip-debug
R_SYSTEM_ABI linux,gcc,gxx,gfortran,gfortran

reference issue #335

@dn-ra
Copy link
Author

dn-ra commented Sep 22, 2021

UPDATE:

I managed to install it after launching Rstudio server while the right environment was activated, but I am still confused as to why I couldn't find an installation of libmkt that included libmkl-rt.so.1 for the system that is outside of miniconda.
In my mind it's not ideal to be linking to a shared library in miniconda that should be installed /usr/lib

Any tips?

@testtraag
Copy link

I installed the library with apt-get, but it doesn't include libmkl-rt.so.1, only libmkl-rt.so

Could you clarify what you installed exactly? You mean apt-get install r-cran-igraph?

I'm not sure what the connection with miniconda is? You are trying to run R from a conda environment? In that case, it is probably easier to install igraph using conda, not using apt-get.

Did the proposed solution of installing libmkl-rt in #335 (comment) using apt not work for you?

@dn-ra
Copy link
Author

dn-ra commented Sep 22, 2021

Thanks for the reply, and sorry for the confusion.

The connection with conda is that after trying to install libkml with apt-get install libmkl-rt, the only copy of libkml-rt.so.1 was in miniconda, presumably from some other unrelated program i had previously installed.

I had to point igraph to that libmkl, because the libmkl I installed with apt-get didn't have libkml-rt.so.1 as was being demanded by install.pacakages('igraph')

I suppose I'm wondering if it's normal for igraph to be requesting libmkl-rt.so.1 when it's not in the standard installation of libmkl. If you're not sure that's ok, but thought i would see if you've heard of others struggling to install igraph with this same issue related to libmkl.

@szhorvat
Copy link
Member

What exactly are you doing when you say that you are "installing" igraph?

Are you trying to install a pre-compiled binary? If yes, from where, and how? Or are you trying to compile it yourself? If yes, which version, and how?

igraph does not depend on the MKL. It just requires a BLAS and a LAPACK implementation. The MKL is one of many libraries that can provide that. It seems that your version of igraph was compiled to link to the MKL. This is why I asked where you got it.

I believe that the precompiled version of igraph on CRAN has nothing in it that makes it want to link to the MKL. So I guess you didn't get it from CRAN.

@dn-ra
Copy link
Author

dn-ra commented Sep 22, 2021

Thanks. So something strange is happening in my installation then because it is trying to install through compilation by default.

I first tried installing another package called Seurat through Bioconductor::install. This triggered the installation of igraph as a dependency, but it tried to install through the compilation route and failed with the above error. When I switched to trying to install it with install.packages (through CRAN) it kept trying to install it through compilation instead of the binary. So following your advice I will specifically request it to install from binary to circumvent the libmkl issue.

Thanks

@vtraag
Copy link
Member

vtraag commented Sep 22, 2021

I believe that the precompiled version of igraph on CRAN

I don't think there are precompiled binaries available for Linux on CRAN, only for macOS and for Windows.

When I switched to trying to install it with install.packages (through CRAN) it kept trying to install it through compilation instead of the binary.

To be clear, the error about libmkl was raised when running install.packages("igraph")? Can you perhaps post the output of the installation & compilation?

@szhorvat
Copy link
Member

I don't think there are precompiled binaries available for Linux on CRAN, only for macOS and for Windows.

I'm sorry, I didn't realize this.

@dn-ra
Copy link
Author

dn-ra commented Sep 27, 2021

Sorry for the slow reply here.
Unfortunately I haven't been able to reproduce the error since I managed to install it.
The error did come about using install.packages('igraph')
Happy for you to close this issue now as I am unable to provide further documentation after finding a way to push through it. If it comes up again I will reopen it. Or maybe I will just switch to windows.

Thanks

@FloHu
Copy link

FloHu commented Oct 20, 2021

This is still an open issue for me, see my post in #275. I get the exact same message as in the first post here and I can also reproduce the error if needed. I installed libmkl-r and libmkl-dev but it did not help.

@FloHu
Copy link

FloHu commented Oct 20, 2021

Update: I solved it, see my answer here: #275 (comment)

@saeedfc
Copy link

saeedfc commented Sep 23, 2023

Update: I solved it, see my answer here: #275 (comment)

This didn't work for me. Even after renaming, 'locate' still seem to find those inside anaconda3/libs as well as anaconda3/pkgs and R hit the same error whjen installing igraph. I just uninstalled anaconda finally and then normally installed igraph from Rstudio. For context, I upgraded OS from Ubuntu 18.04 to 22.04. So understandably I couldn't build on a backed up home directory with previously installed anaconda, R versions etc., So uninstalling and re-installgin did the trick. This will indeed however lead to a lot of time consuming installations across, R and conda
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants