I am trying to install the ProStaR and DAPAR packages with Rstudio (R version 3.6.3). Following the instructions from the instruction manual (https://www.bioconductor.org/packages/release/bioc/vignettes/DAPAR/inst/doc/Prostar_UserManual.pdf) after running the following code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version='3.10')
BiocManager::install("DAPAR")
BiocManager::install("Prostar")
library(Prostar)
Prostar()
I receive the following error messages:
>library(Prostar)
Error: package or namespace load failed for ‘Prostar’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
> Prostar()
Error in Prostar() : could not find function "Prostar"
When trying to separately install the shiny package:
install.packages("shiny")
library("shiny")
I get the same error message:
Error: package or namespace load failed for ‘shiny’:
.onLoad failed in loadNamespace() for 'shiny', details:
call: NULL
error: invalid version specification ‘1,5’
I have to mention that I'm not extremely familiair with R yet. Any help would be greatly appreciated.
You did not include versions of several items in your setup so it's possible this comes from mismatching components (rather than my initial guess that it was due to a corrupt package from whatever mirror was being used.) I needed to upgrade to R 3.6.3 to match that aspect of your set up and in the process noted that Catalina OS users need a different version of R. I'm on Mojave, so my version now produces this on startup:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
I then needed to update my BioConductor installation which was fairly quick but installing the DAPAR package takes a loooong time because of an extensive list of dependencies, some of which have unmet dependencies that required repeated attempts to get the process to completion. Then the Prostar package installation had another batch of unmet dependencies. After finally getting all the unmet dependencies installed, I'm unable to reproduce the error, so I'm thinking you should probably use another repository. I suggest first doing something like:
options(repos = "https://cloud.r-project.org/")
Or choose that mirror specification from the Rstudio setup panel. Then make another attempt.
I suppose it's possible that this issue arises because of a version mismatch of compilers. The CRAN page for MacOS says clang 7 is needed. In my setup I get this (in a Terminal window)
Comutername:~ myusername$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
And for gfortran I get:
GNU Fortran (GCC) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
I did all the R package installations from the R.app interface, so I suppose it's possible that some infelicity in Rstudio's package install process will be needed to explain this. Obviously all teh system installations such as clang and gfortran (and probably PROJ and other GIS packages) would need to be done from the Terminal command line. Sometimes it is safer to do all these installations from a minimal interface, possibly even from R running in a Terminal window. I've generally had good luck with R.app (over a span of 12 years) and less consistent results with Rstudio.
Related
In any R package I try to install, I get the following error message:
ld: library not found for -lintl
collect2: error: ld returned 1 exit status
make: *** [utf8.so] Error 1
I'm not sure how to make this a reprex, but I am running:
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin19.5.0 (64-bit)
Running under: macOS Catalina 10.15.5
What does this error message (ld: library not found for -lintl) mean and how can I fix it to be able to install R packages (the packages I have tried are texreg and lme4)? Thank you.
Edit: I apologize, I thought I had included this with my post. I am not missing gettext (as per Link error installing Rcpp "library not found for -lintl"), and I followed the instructions to export the LPDFLAGS and CPPFLAGS so that they are linked.
As best I can tell, the problem is the ~/.R/Makevars file, which currently looks like this, where I've commented out things I've added to it based on googling.
CC=/usr/local/Cellar/gcc/9.3.0_1/bin/gcc-9
CXX=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
CXX11=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
CXX14=/usr/local/Cellar/gcc/9.3.0_1/bin/g++-9
cxx17=/usr/local/cellar/gcc/9.3.0_1/bin/g++-9
cxx1X=/usr/local/cellar/gcc/9.3.0_1/bin/g++-9
LDFLAGS=-L/usr/local/Cellar/gcc/9.3.0_1/lib
#FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0
#CC=/usr/local/clang4/bin/clang
#CXX=/usr/local/clang4/bin/clang++
#CXX1X=/usr/local/clang4/bin/clang++
#CXX98=/usr/local/clang4/bin/clang++
#CXX11=/usr/local/clang4/bin/clang++
#CXX14=/usr/local/clang4/bin/clang++
#CXX17=/usr/local/clang4/bin/clang++
#LDFLAGS=-L/usr/local/clang4/lib
Apparently, I needed to remove all the lines from ~/.R/Makevars and I was able to install lme4. I did get some warnings, but library(lme4) works.
If you're using a mac with an Apple Silicon chip (like the M1), then you can try adding this to ~/.R/Makevars:
CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include
CXX11FLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib
This allows R to find the needed libraries. You will need to first ensure you have the needed compilers and dependencies installed. You can usually do this with brew.
I'm getting a little bit crazy with this issue. I'm trying to install an R package using conda in my environment (python 2.7) in my home on a cluster (i.e. without root permissions). I firstly installed R in my env using:
conda install -c r r=3.4
Then:
conda install -c conda-forge python-igraph
(because igraph is required by my library of interest)
and finally:
conda install -c conda-forge r-diffusionmap
Unfortunately when I launch R the following message appears:
Error: package or namespace load failed for 'RevoUtilsMath': .onLoad
failed in loadNamespace() for 'RevoUtilsMath', details: call: NULL
error: Remove Microsoft R and then re-install. Be sure to select MKL
libraries as an install option.
During startup - Warning message:
package 'RevoUtils' was built under R version 3.4.3
What does it mean? How can I solve this?
Thank you in advance
I had this same issue after I installed some libraries (Rcpp included) in my root R, but not my conda environment (which screwed up conda). This would cause kernel death anytime a jupyter notebook running R was even opened.
The fix for me was:
Uninstall Anaconda3
Reinstall Anaconda3
Reinstall all the libraries I needed (mostly just Bioconductor in R)
A few other issues popped up, like package inconsistencies, but I dealt with those as described here.
All R packages on conda-forge (or Bioconda) are compiled against one single version or R for each new release branch (usually starting from patch 1, so 3.x.1, except for 3.4.3). This is due to ABI incompatibility problems.
Also note that defaults and conda-forge channels are (where) not binary compatible (although now they should be). And that since 2018 the default anaconda channel is distributing Microsoft R Open as default R, whether all packages from conda-forge should be preferably used with R from conda-forge.
You should be able to solve this issue by installing R using conda install -c conda-forge r-base.
the same error information for me when I open R for run code in ubuntu platform(18.4), and there is no other useful methods to solve it.My R version is 3.4.3.enter image description here
I am trying to use .xlsx library but function write.xlsx is returning error that such can not be found.
When I am installing library(xlsx) in log I can read:
Error : .onLoad nie powiodło się w funkcji 'loadNamespace()' dla pakietu 'rJava', szczegóły:
wywołanie: fun(libname, pkgname)
błąd: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
In addition: Warning messages:
1: pakiet ‘xlsx’ został zbudowany w wersji R 3.3.2
2: pakiet ‘rJava’ został zbudowany w wersji R 3.3.3
Error: pakiet ‘rJava’ nie mógł zostać załadowany
Java is up to date.
The code in the original post fails because the xlsx package uses the Apache POI Java API to Excel, and therefore requires the rJava package. In turn, the rJava package requires a working, compatible version the Java Runtime Environment to be installed on the machine and accessible from R.
One can tell whether Java is accessible from R / RStudio via the system() function.
> system("java -version")
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
>
There are at least four sets of R packages used for working with Excel files, including:
xlsx -- requires rJava package
XLConnect -- requires rJava package
openxlsx -- does not require rJava package
readxl / writexl -- does not require rJava package
For options 3 and 4, the solution is simply to use install.packages() to install the desired package (as noted in another answer by #Linus), once you've updated R to the latest version.
install.packages("openxlsx")
library(openxlsx)
or
install.packages(c("readxl","writexl"))
library(readxl)
library(writexl)
A Working Example: Write to Excel File
library(writexl)
data <- data.frame(matrix(runif(100),nrow=10,ncol=10))
write_xlsx(data,"./data/simpleExcel.xlsx")
...and the output:
If You Must Use rJava...
Unfortunately, options 1 and 2 are considerably more complicated than "install Java." If one must use xlsx or needs the rJava package to support other R packages, installation of Java varies significantly by operating system.
Windows: one must install a version of Java whose architecture is compatible with R (i.e. 32-bit vs. 64-bit). One may consider installing both 32-bit and 64-bit versions because some Windows programs installed on the computer may require 32-bit Java vs. 64-bit. With RStudio, one can configure R to use the 32-bit version of R if only 32-bit Java is installed on the machine.
Mac OS X: one must install Java and run a series of commands that are documented on the rJava Issues GitHub page, including executing an R script to reconfigure Java for R.
Linux: one needs to install Java using the package installer tool appropriate for the version of Linux, and then configure R to use it. For example, in Ubuntu one would install with the advanced packaging tool.
sudo apt-get install openjdk-8-jdk # openjdk-9-jdk has some installation issues
sudo R CMD javareconf
xlsx needs Java. Please install the current Java version from https://www.java.com/de/
and watch out, that both R and java are either 32bit or 64bit as it is stated in the error message
... and make sure R and Java have matching architectures.
Or use writexls or openxlsx. They are not depending on Java (Thanks #Len)
I'm having trouble installing igraph on R 3.1.0 on OS X Mavericks with XCode 5.1.1. The error message I get is:
ld: illegal text-relocation to '___gmp_binvert_limb_table' in /usr/local/lib/libgmp.a(mp_minv_tab.o) from '___gmpn_divexact_1' in /usr/local/lib/libgmp.a(dive_1.o) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
Looking around, I found that I'm not the only one to have this issue and it's not limited to igraph (here and here), but adding CXXFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future to ~/.R/Makevars didn't help. From the error message, it looks like R found the system installation of GMP and not the Macports version, which could conceivably have been built for a different architecture. (Installing from binaries also didn't work for me, with an error message of image not found, but it looks like this is a separate issue.) Has anyone else encountered similar issues?
sessionInfo() gives:
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.0.2 (64-bit)
Thanks in advance!
In case this is helpful to anyone else, here is the solution from Gabor Csardi that worked for me: Try with the binary distribution of R. I had built R from source, and that version didn't work with installing igraph from either source or binary.
The latest version of xts on CRAN is 0.7-5. But I'd like to try out the blotter package, for which xts >= 0.7.6.17 is required. To get this latest version, I first I downloaded the .tgz file from RForge and tried:
[Downloads]$ R CMD INSTALL xts_0.7-6.17.tgz
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...
* DONE (xts)
After launching R console, I typed require(xts) and got this:
> require(xts)
Loading required package: xts
Loading required package: zoo
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so, 6): Library not loaded: /usr/local/lib/libgfortran.2.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.12/Resources/library/xts/libs/x86_64/xts.so
Reason: image not found
In addition: Warning message:
package 'xts' was built under R version 2.12.2
I reverted to the CRAN version by downloading that file and running this again:
[Downloads]$ R CMD INSTALL xts_0.7-5.tgz
WARNING: ignoring environment value of R_HOME
* installing to library ‘/Library/Frameworks/R.framework/Resources/library’
* installing *binary* package ‘xts’ ...
* DONE (xts)
Opening R console and typing in require(xts):
> require(xts)
Loading required package: xts
Loading required package: zoo
>
All is well again, except I need to RForge version to get blotter installed.
NOTE: I'm running OS X (10.6.6)
UPDATE: all is NOT well. Now I can't get the CRAN xts version to load properly.
UPDATE #2: I got my old xts back by running install.packages("xts", repo="http://cran.r-project.org"). Actually, I ran it for "quantmod" and "TTR" as well because all manner of mysterious breaking was occurring.
UPDATE #3: Following Dirk's recommendation in comments below, I've attempted to compile from source on OS X and was met with
make: gfortran: No such file or directory
So after installing from the link at http://www.macresearch.org/xcode_gfortran_plugin_update, I'm now faced with a new error complaining about the -arch flag:
gfortran -arch i386 -fPIC -g -O2 -c period.max.f -o period.max.o
f951: error: unrecognized command line option "-arch"
UPDATE #4: I installed the wrong fortran compiler in UPDATE #3. Don't use that compiler for R packages.
If you are using R on the Mac OS X platform, then it's good to know the mechanics of installing from source, as Mac binaries are sometimes slow to make it to repositories. The R eco-system is Ubuntu and SVN. Someday it may morph to OS X and Git (we can hope, no?)
Before you start installing from source, you need to make sure you have Xcode installed.
http://developer.apple.com/technologies/tools/xcode.html
Then you need to have a fortran compiler, which doesn't come with Xcode. The good news is that there is a place devoted to fortran compilers on OS X for R users.
http://r.research.att.com/tools/
Once this is installed and configured properly, you need to get the cutting-edge version of xts from RForge from here: (Thanks Dirk)
http://r-forge.r-project.org/src/contrib/xts_0.7-6.17.tar.gz
Finally, simply run the following from command-line in terminal:
[Downloads]$ R CMD INSTALL xts_0.7-6.17.tar.gz
NOTE: tar.gz is the extension for source files while .tgz is the extension for Mac binaries.