problem installing ComplexHeatmap. ERROR: compilation failed for package ‘cluster’ - r

i am installing an R package called complex heatmaps (https://jokergoo.github.io/ComplexHeatmap-reference/book/). I get this error. So far i just identified it might be do to this package : https://packages.debian.org/buster/r-cran-cluster but i am not sure what to do at all. Thats why i am writing you.
Thanks a lot for your help
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'cluster.so' failed
make: *** [cluster.so] Error 1
ERROR: compilation failed for package ‘cluster’
* removing ‘/home/luca/R/x86_64-pc-linux-gnu-library/3.6/cluster’
Error: Failed to install 'ComplexHeatmap' from GitHub:
(converted from warning) installation of package ‘cluster’ had non-zero exit status

The error message indicates that you are missing libfortran.so. You might even miss more tools necessary for installing R packages from source. How to install this depends on the Linux distribution you are using. For Debian, which you mention in the question, this would be
sudo apt install r-base-dev
If you want to speed up package installation, you can also use the binary packages available in Debian, i.e.
sudo apt install r-cran-cluster

Related

Unable to install package "quanteda.textstats" in R under Ubuntu 22.04.1 LTS

I am trying to install the package quanteda.textstats in R under Ubuntu Version 22.04.1 LTS.
I initially ran:
install.packages("quanteda.textstats")
where I got an error message saying it could not install the dependency proxyC. I was able to install that, but I still get an error message when running the above code.
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: quanteda.textstats.so] Error 1
ERROR: compilation failed for package ‘quanteda.textstats’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.2/quanteda.textstats’
Warning in install.packages :
installation of package ‘quanteda.textstats’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpuUtAq1/downloaded_packages’
I would guess I am missing certain dependencies, but I am unable to figure out what -llapack and -lblas stands for.
I also tried running the github install (option 3):
remotes::install_github("quanteda/quanteda.textstats")
but there as well I get a similar error:
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: quanteda.textstats.so] Error 1
ERROR: compilation failed for package ‘quanteda.textstats’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.2/quanteda.textstats’
Warning message:
In i.p(...) :
installation of package ‘/tmp/RtmpuUtAq1/file17581cc7f39c/quanteda.textstats_0.96.tar.gz’ had non-zero exit status
Can anybody help please?
Your are trying to compile the package which requires to have certain system dependencies installed, in this case lblas and llapack. This is not the recommended way to install R packages on Ubuntu. Instead you should install them as PPAs as described on CRAN.
If you insist on compiling the package yourself, install the dependencies via apt in the system terminal:
sudo apt-get install libblas-dev liblapack-dev

Installing R package from CRAN archive has non-zero exit status

I need to install fwildclusterboot, a package that has been removed from CRAN.
I tried installing it as follows:
library(devtools)
install_url("https://cran.r-project.org/src/contrib/Archive/fwildclusterboot/fwildclusterboot_0.9.tar.gz")
However, I end up getting the following error message at the end of the installation process (I have a MacBook, MacOS Monterey 12.5.1, and my RStudio is version 2022.07.1):
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [fwildclusterboot.so] Error 1
ERROR: compilation failed for package ‘fwildclusterboot’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/fwildclusterboot’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/1n/m1g55_416rj6m4w3v6v9x2340000gn/T//RtmppWJnds/fileaae0dc5e6aa/fwildclusterboot_0.9.tar.gz’ had non-zero exit status
How can I solve this?
I had the same problem some months before, this is the easy way,
Go to: https://github.com/fxcoudert/gfortran-for-macOS/releases an you'll find the lastest version for Monterey with an easy installer (.dmg), select depending if you have an ARM or Intel based computer.

Package fracdiff of R fails to install in Linux Mint

I am installing the package forecast. However, I get a persistent error because the package fracdiff fails with this error:
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'fracdiff.so' failed
make: *** [fracdiff.so] Error 1
ERROR: compilation failed for package ‘fracdiff’
* removing ‘/home/mario/R/x86_64-pc-linux-gnu-library/3.4/fracdiff’
Warning in install.packages :
installation of package ‘fracdiff’ had non-zero exit status
Normally, when I see had non-zero exit status, it is for me a clue telling me that I should go to Synaptic and search for the library r-cran-fracdiff. However, this library is not present in my repositories, and don't really know how to solve this issue.
Any idea?
"/usr/bin/ld: cannot find -lXXX" tells you that you should be looking for a library named something like "libXXX-dev".
In this case I would install libblas-dev and perhaps also liblapack-dev, as explained here.

How can I deal with this nloptr error in R?

init_nloptr.c:35:10: fatal error: 'nlopt.h' file not found
#include "nlopt.h"
^~~~~~~~~
1 error generated.
make: *** [init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/nloptr'
Warning in install.packages :
installation of package 'nloptr' had non-zero exit status
I got this error message when I installed nloptr package which need to install mi package.
From the path showing up in the error message, it looks like you're running on macOS.
If so, you must install the nlopt system library before installing nloptr.
Hopefully you have Homebrew installed (if not, please reply/comment and I will attach some further info), hence open the Terminal and run
brew install nlopt
At the end of the brew install command, go back to R and install nloptr.

How to install package 'coin' in R 3.1.3

I am using R 3.1.3 and I need to install the package coin to be able to extract z values from the outout of the wilcoxon test, as explained here.
I tried installing the coin library, but I got the following error:
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [coin.so] Error 1
ERROR: compilation failed for package ‘coin’
* removing ‘/home/hlabbeg1/R/i486-pc-linux-gnu-library/3.1/coin’
Warning in install.packages :
installation of package ‘coin’ had non-zero exit status
I tried installing the packages lblas and lgfortran but in both cases I get a message saying the packages are not available for R version 3.1.3. I couldn't even find them on the cran repositories.
Trying to install the package directly gives me the following error:
Error in rawToChar(block[seq_len(ns)]) :
embedded nul in string: 'PK\003\004\n\0\0\0\0\0\xb1\004\x8fF\0\0\0\0\0\0\0\0\0\0\0\0\005\0\0\0coin/PK\003\004\024\0\002\0\b\0\xae\004\x8fF\xce\xe2\x91\xcb6\002\0\0:\006\0\0\r\0\0\0coin/CITATION\xad\x93Qo\xda0\020ǟɧ8\xf9)Hi\xa0\xa0\xb1\b\xa9\017'
Any idea oh how to install these packages so I can get coin?
Thanks.

Resources