Problems with loading package
VirginiaWe opened this issue · 15 comments
Hi
I have some problems loading the package. The following error message appears:
`The following object is masked from ‘package:base’:
union
Error: package or namespace load failed for ‘leidenAlg’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/leidenAlg/libs/leidenAlg.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/leidenAlg/libs/leidenAlg.so, 6): Library not loaded: @rpath/igraph.so
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/leidenAlg/libs/leidenAlg.so
Reason: image not found`
R. Version()
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 6.2
year 2019
month 12
day 12
svn rev 77560
language R
version.string R version 3.6.2 (2019-12-12)
nickname Dark and Stormy Night
Any tips?
Hi @VirginiaWe
Did you install the package via CRAN?
If not, how did you install the package?
Best, Evan
I believe the Mac OS binaries work: https://cran.r-project.org/web/packages/leidenAlg/index.html
Please install the package with install.packages("leidenAlg")
.
If this does not solve your issue, there are some notes here: https://github.com/kharchenkolab/leidenAlg/wiki/Installing-leidenAlg-for-Mac-OS
Best, Evan
Hello Evan
Thanks for your feedback.
I have tried different things - install via CRAN, install package locally and install from source according to the description in the wiki. I didn't have any problems with either the installation, the error message appears only when loading the package. I have furthermore tried it on two different Macs - same error message!
Thanks, V
Hi @VirginiaWe
I'm guessing the error is here:
Library not loaded: @rpath/igraph.so
The error is mine, as I'm assuming that users have installed igraph
: https://github.com/kharchenkolab/leidenAlg/blob/master/src/Makevars#L3-L7
Please try installing igraph
and then install leidenAlg
:
https://cran.r-project.org/web/packages/igraph/index.html
I'll try to update the DESCRIPTION
and re-release on CRAN.
Thanks, Evan
I actually have igraph already installed... maybe it is some path problem.
What do you get when you open R and type:
library(igraph)
cat(system.file("libs", package="igraph"))
?
Based on what you provided above, you should get /Library/Frameworks/R.framework/Versions/3.6/Resources/library/igraph/libs
Yes thats exactly what I got! Weird...
With regards to the above, igraph
is a dependency:
https://github.com/kharchenkolab/leidenAlg/blob/master/DESCRIPTION#L11
Depends: R (>= 3.5.0), Matrix, igraph
I'll add it to linking and re-release on CRAN with version 0.1.2:
https://github.com/kharchenkolab/leidenAlg/blob/master/DESCRIPTION#L23
LinkingTo: Rcpp, RcppArmadillo, RcppEigen, igraph
Otherwise, I'm stumped----it works for me with R version 4.0.3. Perhaps try a newer version of R?
Best, Evan
Including LinkingTo: igraph
is also not the answer
I guess I would have to see your installation logs to better understand what's going on here. At the moment, I don't get it.
Perhaps try a newer version of R just to be sure.
Hi Evan, I got the same issue here. I have installed igraph, leidenAlg and conos via CRAN without any problem (no error messages). Here example for leidenAlg installation:
> install.packages('leidenAlg')
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/leidenAlg_0.1.1.tgz'
Content type 'application/x-gzip' length 631240 bytes (616 KB)
----------------------------------------------------------
downloaded 616 KB
The downloaded binary packages are in
/var/folders/r0/r0gdf3bx0hbgpkv8x9dmc31w0000gp/T//RtmpvAA8JO/downloaded_packages
But when I try to load the packages, I get the same error message for both leidenAlg and conos (no error message when loading igraph):
> library(leidenAlg)
Error: package or namespace load failed for ‘leidenAlg’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so, 6): Library not loaded: @rpath/igraph.so
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so
Reason: image not found
> library(conos)
Error: package or namespace load failed for ‘conos’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so, 6): Library not loaded: @rpath/igraph.so
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/leidenAlg/libs/leidenAlg.so
Reason: image not found
I have also the R version 4.0.3. (2020-10-10), Platform: x86_64-apple-darwin17.0 (64-bit)
Seems like both leidenAlg and conos are not able to recognize igraph. But not sure. Any idea?
Thanks in advance!
Hi @CrLou
Given you're both having issues, it's possible that perhaps recent updates to Mac OS and XCode is causing some issue....
There's a section in the Makevars file which links to the igraph shared object igraph.so
, here: https://github.com/kharchenkolab/leidenAlg/blob/master/src/Makevars#L10
Questions:
(1)
Are you able to successfully install and use these packages from CRAN? Please give them a try:
https://cran.r-project.org/web/packages/N2R/index.html
https://cran.r-project.org/web/packages/pagoda2/index.html
(2)
Another thing that would be helpful for me is if you follow these instructions, and try to compile the package locally for yourself: https://github.com/kharchenkolab/leidenAlg/wiki/Installing-leidenAlg-for-Mac-OS
I just haven't experienced this behavior, so it's difficult for me to debug. I'll look into this in more depth in the next few days....
One thing that comes to mind is that users have to install igraph along with various other libraries, especially libxml2
:
I just tried installing the libraries within a fresh Docker container here: https://hub.docker.com/r/rocker/rstudio using the command:
docker run --rm \ -p 127.0.0.1:8787:8787 \ -e DISABLE_AUTH=true \ rocker/rstudio
I can install igraph
and leidenAlg
, but cannot use the R libraries as the required C/C++ libraries are not available:
> install.packages('igraph')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/igraph_1.2.6.tar.gz'
Content type 'binary/octet-stream' length 8427431 bytes (8.0 MB)
==================================================
downloaded 8.0 MB
* installing *binary* package ‘igraph’ ...
* DONE (igraph)
The downloaded source packages are in
‘/tmp/Rtmpkiza77/downloaded_packages’
> library(igraph)
Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/igraph/libs/igraph.so':
libxml2.so.2: cannot open shared object file: No such file or directory
> library(leidenAlg)
Loading required package: Matrix
Loading required package: igraph
Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/igraph/libs/igraph.so':
libxml2.so.2: cannot open shared object file: No such file or directory
Error: package ‘igraph’ could not be loaded
So, I wonder if you have igraph
installed correctly....
Hi Evan,
Thanks for the quick reply!
First, N2R
and Pagoda2
work perfectly fine. Actually I have been running Pagoda2
over the last 2 days and I haven't encountered any problem.
The problem might be with igraph
as you suggested. I've just checked if I have the additional igraph
libraries installed in the system, but I'm missing one --> libxml2
.
I have tried to installed it via CRAN but I can't:
> install.packages("libxml2")
Warning in install.packages :
package ‘libxml2’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
I might need a work around. I'll try now the devtools installation devtools::install_github("r-lib/xml2")
and let you know if it works. Meanwhile if you have any suggestion, more than welcome. I'll be happy..
Thanks again!
Cristina
You'll need to install the C/C++ libraries, e.g.
Debian-based users of Linux can install libxml2 via
sudo apt-get update
sudo apt-get install libxml2-dev
For Mac OS, the commands with the Homebrew package manager are as follows:
brew update
brew install libxml2
But this is just one of the libraries required; there could be others for igraph
. Please see https://igraph.org/r/
EDIT: The required packages are the following
Debian-based users of Linux can install the required packages via:
sudo apt-get update
sudo apt-get install libxml2-dev libgmp-dev libglpk-dev
For users of Red Hat distributions, use the following command to install the required packages:
sudo yum update
sudo yum install libxml2-devel gmp-devel glpk-devel
For Mac OS, the commands with the Homebrew package manager are as follows:
brew update
brew install libxml2 glpk gmp
Related: #5