Rserve installation on macos 11 Big Sur - r

I have upgraded mac OS to version 11 - Big Sur. Since then, I'm not able to install Rserve package. I've tried the installation using the following command:
install.packages('Rserve',,'http://www.rforge.net/')
Unfortunately, the result is a non-zero exit and the output contain the following messages:
configure error: R was configured without --enable-R-shlib or --enable-R-static-lib```
*** Rserve requires R (shared or static) library.
*** Pleae install R library or compile R with either --enable-R-shlib
or --enable-R-static-lib support.
Alternatively use --without-server if you wish to build only Rserve client.
No Rserve client is totally no option for me. Do you have any suggestions what can I do go get Rserve installed?
Thanks a lot for your help!

Related

Exporting excel files from R in windows [duplicate]

I am trying to load the rJava using the command:
library(rJava)
But I get the following error:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package or namespace load failed for ‘rJava’
I tried reinstalling both the Java and the R program with the latest versions
but still get these errors..
May I know how I can resolve this? Thank you very much!
This error is often resolved by installing a Java version (i.e. 64-bit Java or 32-bit Java) that fits to the type of R version that you are using (i.e. 64-bit R or 32-bit R). This problem can easily effect Windows 7 users, since they might have installed a version of Java that is different than the version of R they are using.
http://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/
Install 64 bit Java from https://java.com/en/download/manual.jsp.
Then in windows cmd run
setx PATH "C:\Program Files\Java\jre1.8.0_211\bin\server;%PATH%"
(make sure your path is correct).
Then in RStudio run
Sys.setenv(JAVA_HOME="")
Now, you should be able to run rJava!!
I got the same error resolved by installing same version of R and Java i.e. 64 bits and manually updating the path i.e. ,
Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_121') # for 64-bit version
R for Windows installer installs by default both 32-bit and 64-bit files. Reinstalling R and unticking 32-bit part solved the problem for me.
Under Windows 10, first check your (running) R-Version:
R.version
If you see something like x86_64, a 64-bit version of Java is needed.
Simply downloading and installing the matching Java version (https://java.com/en/download/manual.jsp) solved the problem for me. No reinstall of R needed (as suggested by other users here). There also was no need to set the path explicitly.
As mentioned in the r-statistics link cited above, you have to manually download the 64-bit version of Java. If not, then the 32-bit version will be installed.
So, if you have a 64-bit operating system, then ensure that both R and Java are using the 64-bit installs. Otherwise, this problem will persist.
This has been killing me and I have tried multiple methods above, it doesn't work. After, I mix all solution to try and below process works for me.
Install Java for 64 bit
Run below code in windows command
setx PATH "C:\Program Files\Java\jre1.8.0_171\bin\server;%PATH%"
(please change the address acorrding to your dvm.dll real address)
Run below in R studio
Sys.setenv(JAVA_HOME="")
Then I finally can run
library(rJava)
library(xlsx)
I faced the same issue and was feeling very down as I couldnt get my analysis done.
This worked for me :
check your operating system. 64 bit or 32 bit.
https://helpx.adobe.com/x-productkb/global/determine-whether-computer-running-32.html
uninstall previous versions of Java.
delete rJAVA library from Doc>R>win-library. If you have more than 1 versions of R, make sure you delete rJAVA package from all of them.
install Java based on system requirement (64 bit or 32 bit).
and finally restart R before and after installing rJava package.
If R is 64-bit version make sure to install Java 64-bit version!
If R is x86-bit version make sure to install Java x86-bit version!
You can add INSTALL_opts=c("--no-multiarch") to your install_github() call:
devtools::install_github("mne-tools/mne-r", INSTALL_opts=c("--no-multiarch"))
For more info: https://github.com/mne-tools/mne-r/issues/5#issuecomment-489588267
Create a new directory in C: drive as "library"
set your libPath this directory. you need to type
.libPath("C:/library")
reinstall packages which requires java (xlsx, rJava, RJDemetra)
it will give error message again but it will work.

write.xlsx function not working

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)

'curl_version_info_data' has no member named 'libssh_version'

I need to install plotly package for R(3.3.1) in a Redhat server 5.11. It requires curl to be installed first. I downloaded the package from https://cran.r-project.org/web/packages/curl/index.html.
When I try to install the package, it gives below error:
version.c: In function 'R_curl_version':
version.c:15: error: 'curl_version_info_data' has no member named 'libssh_version'
version.c:15: error: 'curl_version_info_data' has no member named 'libssh_version'
make: *** [version.o] Error 1
ERROR: compilation failed for package 'curl'
Has anyone had the same issue before?
Thanks in advance for any suggestion.
You need to install the development version of the curl library before installing the package. Try yum install curl-devel.
One note though - whenever you run into a similar error it is typically because a development version of a library is not installed on your redhat system.
Thanks Jim for your reply.
I found the solution is to use a lower version curl package which has not included the definition for "libssh_version" in the file version.c, e.g. curl_0.9.6.tar.gz with the command:
sudo R CMD INSTALL curl_0.9.6.tar.gz
I've also tried "yum install curl-devel", but it shows the message:
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
Package curl-devel-7.15.5-17.el5_9.x86_64 already installed and latest version
Package curl-devel-7.15.5-17.el5_9.i386 already installed and latest version
Nothing to do

Shiny package installation on R version 3.0.2 "Frisbee Sailing"

I need some help with installing Shiny package on the following system:
Ubuntu 12.04 64 bits
R version 3.0.2 "Frisbee Sailing"
When I try to install a Shiny package by running:
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
I tried different repos or even by running install.packages('shiny') in R session as sudo, the package fails to install.
There's no errors, but rather a message that "The downloaded source packages are in '/tmp/....'
and when I try to use it (library(shiny)), I got an error that package was not found.
Now, I did not have same issue and everything worked fine on:
Ubuntu 12.04 64 bits
R version 3.0.1 "Good Sport".
Please, help me see what I am missing here.
The issues you are describing are caused by out-of-memory crashes. You are probably on a VPS like EC2 or something similar. If you are using the free micro instance on EC2 or the lowest package( 512mb ram) on digital ocean then you should enable swap (you should enable swap anyway). For EC2 see How do you add swap to an EC2 instance? . For digital ocean see https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
Actually, I just tried to install a different library, ggplot2, and it is the same issue.
So, it is not related to Shiny package. All the libraries I tried to install just keep being saved to a /tmp folder as archived gz files. Not really sure why R does not install them.
So, eventually I just used R CMD INSTALL [path to the package .gz]
and it worked all right. I installed all 3 libraries in the following order: Rcpp, httpuv and the shiny. library(shiny) command now loads the library ok.

R studio failing to use rJava lib and failing javareconf

I'm running Rstudio on its own server.
Java is installed with good java_home and bin.
R is installed. rJava is installed.
Tried to do command: library("rJava") but had issues with libjvm.so, do following Rstudio recommandation I did sudo R CMD javareconf with root.
Here is the output of my javareconf:
Java interpreter : /home/scoremd/jdk1.7.0_03/jre/bin/java
Java version : 1.7.0_03
Java home path : /home/scoremd/jdk1.7.0_03
Java compiler : /home/scoremd/jdk1.7.0_03/bin/javac
Java headers gen.: /home/scoremd/jdk1.7.0_03/bin/javah
Java archive tool: /home/scoremd/jdk1.7.0_03/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/jre/lib/amd64:$(JAVA_HOME)/jre/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Seems there is issue with finding the java library path... but my java is working fine and R also.
I didn't receive any solution from RStudio support and community (told me to ask in SO ....).
I have rstudio-server installed on my Centos server. There are a couple of users using rstudio and we decided to upgrade R from 3.6 to 4.0.
After the upgrade :
all users were running R 4.0.
No user could install rJava using install.package('rJava'). This error always popped up
configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
Running SUDO R CMD javareconf went smoothly, and also when I opened R as root and went along and tried install.packages('rJava') it installed the package just fine. (unbeknownst to me, root ran R 3.6 and users 4.0, see solution below)
However it did not work installing the package for users in R studio server. Always stating the same "try running sudo R CMD javareconf" as if the Java path for the users was wrong.
so we tried setting the "JAVA_HOME" variable to the same path that java jdk was installed in (found by searching installed packages in yum). That did not solve it.
my solution
I saw that root was running version 3.6 of R while all users ran 4.0. This was because I had installed 4.0 in another directory.. The directory of R 4.0 happens to be found first by the users. However for the root user... it finds the path of R 3.6 first.
So I set the path to the 4.0 folder in the $PATH variable of the root user, so that would find version 4.0 before finding R 3.6
echo $PATH
export PATH="/usr/local/bin:$PATH"
echo $PATH
Then I ran R as that user and ran "R CMD javareconf", installed the packages and all users are happy and working again.
(disclaimer, I'm not a experienced linux admin, there may be a better solution for running different R versions)
It's been some time since I used rJava, and it was on Windows, but I have some notes which may help you:
Make sure that the JRI native library is in a directory listed in java.library.path
(also confirmed using Process Explorer that jri.dll is being loaded)
The R process loads up jvm.dll when you do library(rJava)
Replace jvm.dll iny my notes above with libjvm.so in your case, and jri.dll with whatever .so file is relevant to you.

Resources