configuration failed for package ‘rJava’ when running rize - R - r

I am trying to use the rize package to create a Dockerfile for ShinyApp. Starting the rize::shiny_dockerize() comand from the App dir. One of the packages which are required is the xlsx (Probably hier it is trying also to install rJava). I get the following error:
trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 MB)
==================================================
downloaded 9.0 MB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... ./configure: line 3766: /usr/bin/java: No such file or directory
no
configure: error: Java interpreter '/usr/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/site-library/rJava’
Error in i.p(...) :
(converted from warning) installation of package ‘rJava’ had non-zero exit status
Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted
The command '/bin/sh -c R -e "setwd('/srv/shiny-server/app'); automagic::automagic()"' returned a non-zero code: 1
Error in rize::shiny_dockerize() : object 'view_app' not found
does anyone how I can bring this to work in the rize package?

It looks like you have issues with setting proper location of Java. Note that making R happy with Java might be a little bit of struggle.
Take a look here: http://www.owsiak.org/r-java-11-and-making-sure-you-can-load-rjava/ for a sample. It is macOS based, but still, it should work fine.
Basically, what you want to do is to set your JAVA_HOME such way it points at Java installation. Once it's done, you can run R cmd javareconf like this
> sudo R CMD javareconf \
JAVA_HOME=${JAVA_HOME} \
JAVA=${JAVA_HOME}/bin/java \
JAVAC=${JAVA_HOME}/bin/javac \
JAVAH=${JAVA_HOME}/bin/javah \
JAR=${JAVA_HOME}/bin/jar
Make sure you have gcc installed and that you can compile simple C code.

rJava takes some time to install and is uaully a package which gives me a lot of issues. Here is what has generally worked for me in the past.
Install the JAVA JDK from: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
In the command line run : sudo R CMD javareconf
if rJava library is not installed, (this particular version works for me but you could try installing the latest version)
devtools::install_version("rJava", version = "0.9-9", repos = "http://cran.us.r-project.org")
Restart R and attempt to reload the xlsx package
Caution: A lot of stackoverflow questions on this topic have advised people to alter environment variables. This has not been nessasary for me personally.
sudo R CMD javareconf should take care of this.

Related

install Acumos package in R

When I tried to install Acumos package in R, I failed. It seems it is due to protobuf and most particulary common.h file. I use R version 3.5.1.
install.packages("acumos",,c("http://r.research.att.com","http://rforge.net"))
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependency ‘RProtoBuf’
trying URL 'http://r.research.att.com/src/contrib/RProtoBuf_0.4.12.tar.gz'
Content type 'application/x-gzip' length 1263377 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
trying URL 'http://rforge.net/src/contrib/acumos_0.2-7.tar.gz'
Content type 'application/x-gzip' length 9383 bytes
==================================================
downloaded 9383 bytes
* installing *source* package ‘RProtoBuf’ ...
** package ‘RProtoBuf’ successfully unpacked and MD5 sums checked
- checking for g++... g++
- checking whether the C++ compiler works... yes
- checking for C++ compiler default output file name... a.out
- checking for suffix of executables...
- checking whether we are cross compiling... no
- checking for suffix of object files... o
- checking whether we are using the GNU C++ compiler... yes
- checking whether g++ accepts -g... yes
- checking how to run the C++ preprocessor... g++ -E
- checking for gcc... gcc
- checking whether we are using the GNU C compiler... yes
- checking whether gcc accepts -g... yes
- checking for gcc option to accept ISO C89... none needed
- checking whether we are using the GNU C++ compiler... (cached) yes
- checking whether g++ accepts -g... (cached) yes
- checking for pkg-config... no
- checking for protoc... yes
- checking for grep that handles long lines and -e... /bin/grep
- checking for egrep... /bin/grep -E
- checking for ANSI C header files... yes
- checking for sys/types.h... yes
- checking for sys/stat.h... yes
- checking for stdlib.h... yes
- checking for string.h... yes
- checking for memory.h... yes
- checking for strings.h... yes
- checking for inttypes.h... yes
- checking for stdint.h... yes
- checking for unistd.h... yes
- checking google/protobuf/stubs/common.h usability... no
- checking google/protobuf/stubs/common.h presence... no
- checking for google/protobuf/stubs/common.h... no
- configure: WARNING: Protobuf headers not found with default CXXFLAGS and
- CPPFLAGS, manually trying /usr/local/include
- configure: WARNING: Unsetting ac_cv_header_google_protobuf_stubs_common_h
- checking google/protobuf/stubs/common.h usability... no
- checking google/protobuf/stubs/common.h presence... no
- checking for google/protobuf/stubs/common.h... no
- configure: error: ERROR: ProtoBuf headers required; use '-Iincludedir' in
CXXFLAGS for unusual locations.
- ERROR: configuration failed for package ‘RProtoBuf’
* removing ‘/usr/local/lib/R/site-library/RProtoBuf’
- ERROR: dependency ‘RProtoBuf’ is not available for package ‘acumos’
* removing ‘/usr/local/lib/R/site-library/acumos’
- The downloaded source packages are in
‘/tmp/RtmpdARWMZ/downloaded_packages’
- Warning messages:
- 1: In install.packages("acumos", , c("http://r.research.att.com", "http://rforge.net")) :
- installation of package ‘RProtoBuf’ had non-zero exit status
- 2: In install.packages("acumos", , c("http://r.research.att.com", "http://rforge.net")) :
- installation of package ‘acumos’ had non-zero exit status
RProtoBuf maintainer here: the requirements (on a Debian/Ubuntu system) are enumerated clearly in this Dockerfile we now use for the Travis CI tests of that package:
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
r-cran-rcpp \
r-cran-rcurl \
r-cran-runit \
r-cran-rmarkdown \
r-cran-knitr \
protobuf-compiler \
protobuf-c-compiler \
libprotobuf-c-dev \
libprotobuf-dev \
libprotoc-dev \
&& install.r pinp
This combines the R and ProtocolBuffer requirements, so if you "just" want to build the package you need at least
protobuf-compiler protobuf-c-compiler libprotobuf-c-dev libprotobuf-dev libprotoc-dev
and you may get away without the compilers if you never want to compile .proto files.
I believe R is looking for the Google protocol-buffer header files that are in package libprotoc-dev, install that like this on Ubuntu:
sudo apt-get install libprotoc-dev
I pointed you to the command-line package previously, sorry about that.
If all else fails, use the force and download the source from https://github.com/protocolbuffers/protobuf

Non-Zero Exit Status in R

I have the typical nonzero exit status problem that I have seen a lot on this forum. However I have tried all of the fixes that one traditionally uses in order to fix this problem and none work. For the full code please see below. I am running Linux Mint OS 64 bit, which I recently installed to run MATLAB, and I suspect that my issue has something to do with that. I had Linux Mint OX 32 bit before and did not have these kind of problems.
A new problem occurred while trying to install plm. The below script comes out, including the error message at the bottom, and then R crashed, which never happened before:
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... no
checking nlopt.h presence... no
checking for nlopt.h... no
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt- 2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpKVJuVy/R.INSTALL129b11f84296/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
The reason is that package uses old location.
Do following, to see where this file was moved.
> curl "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz" -o nlopt-2.4.2.tar.gz
> cat nlopt-2.4.2.tar.gz
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved here.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at ab-initio.mit.edu Port 80</address>
</body></html>
Then, try to download file: https://github.com/stevengj/nlopt/releases/download/nlopt-2.4.2/nlopt-2.4.2.tar.gz
And install this package using R
curl "https://github.com/stevengj/nlopt/releases/download/nlopt-2.4.2/nlopt-2.4.2.tar.gz" -o nlopt-2.4.2.tar.gz
R CMD INSTALL nlopt-2.4.2.tar.gz

How to install & locate ODBC headers sql.h and sqlext.h on a macOS

I am trying to install package RODBC via CRAN on MacBook Air with OS 10.12.
I am receiving the below error:
Installing package into ‘/Users/aaron.samuels/Library/R/3.3/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘RODBC’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘RODBC’
trying URL 'https://cran.rstudio.com/src/contrib/RODBC_1.3-14.tar.gz'
Content type 'application/x-gzip' length 1163799 bytes (1.1 MB)
==================================================
downloaded 1.1 MB
* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files...
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
configure: error: "ODBC headers sql.h and sqlext.h not found"
ERROR: configuration failed for package ‘RODBC’
* removing ‘/Users/aaron.samuels/Library/R/3.3/library/RODBC’
Warning in install.packages :
installation of package ‘RODBC’ had non-zero exit status
The downloaded source packages are in
/private/var/folders/3l/nrtzvm592736jz_qh_5l1wbmffq3bz/T/RtmpeuPUR0/downloaded_packages
Any suggestion on how I can easily install these headers and subsequently successfully install RODBC?
I found an official Microsoft Source that enable the ODBC driver.
You just need to run this lines on the Terminal
/usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install --no-sandbox msodbcsql17 mssql-tools
Use the below command to get rid of error thrown while installing RODBC package in R.
sudo zypper install unixODBC-devel
Thanks #Rafa Barragan.
Following commands worked for me on my mac-os (Mojave version).
Run following commands in terminal -
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql17 mssql-tools
configure: error: "ODBC headers sql.h and sqlext.h not found" means that ODBC drivers are not installed on your mac.
I would install iODBC and make sure the header files are present in the path

Can't get RQuantLib working with brew installed quantlib under osx 10.9.4

I've been trying to install RQuantLib package via
install.packages("RQuantLib")
It keeps giving me the following errors
* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... no
configure: error: Boost development files not found
ERROR: configuration failed for package ‘RQuantLib’
* removing ‘/usr/local/Cellar/r/3.1.1/R.framework/Versions/3.1/Resources/library/RQuantLib’
I've already done
brew install boost
brew install quantlib
and I've checked the sym links for both, which should be fine (done unlink/link for both).
SOLUTION :
Used the command below based on edd's answer, worked for me
install.packages("RQuantLib", configure.args="--with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/")
Try to do it either in a shell based on the *.tar.gz file using these
edd#max:~/git/rquantlib(master)$ ./configure --help|grep boost
--with-boost-include=INCLUDE_PATH
--with-boost-lib=LIB_PATH
edd#max:~/git/rquantlib(master)$
or look at the help for install.packages() where you can pass arguments to configure as well -- I find the first method easier.
In essence, it seems that we need to help configure find your Boost headers (and then probably also the library).

Installation of package ncdf fails due to missing header although it's there

I'm trying to install the r package ncdf on an Ubuntu 10.04 server:
install.packages("ncdf", type = "source")
Installing package into ‘/home/me/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/ncdf_1.6.6.tar.gz'
Content type 'application/x-gzip' length 79403 bytes (77 Kb)
opened URL
==================================================
downloaded 77 Kb
* installing *source* package ‘ncdf’ ...
** package ‘ncdf’ successfully unpacked and MD5 sums checked
checking for nc-config... no
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking netcdf.h usability... no
checking netcdf.h presence... no
checking for netcdf.h... no
configure: error: netcdf header netcdf.h not found
ERROR: configuration failed for package ‘ncdf’
* removing ‘/home/me/R/x86_64-pc-linux-gnu-library/3.0/ncdf’
Warning in install.packages :
installation of package ‘ncdf’ had non-zero exit status
I also downloaded the source package and tried to install in the shell, but got the same result.
wget http://cran.r-project.org/src/contrib/ncdf_1.6.6.tar.gz
R CMD INSTALL ncdf_1.6.6.tar.gz
Obviously, the installer doesn't find the correct header file. So I searched the file manually and found it:
root#fourier:/usr/include# ls -ahl netcdf.h
-rw-r--r-- 1 root root 30K 2009-12-22 04:47 netcdf.h
Packages netcdf-bin, netcdf-dbg, netcdf-doc, libnetcdf-dev and libnetcdf4 are all properly installed. apt-get is up to date. This is my session info:
R version 3.0.1 (2013-05-16)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.0.1
How can I persuade the R installer to use the header file located under /usr/include?
You need to look at the configure.in script to see exactly what it tests for. Maybe it is expecting netcdf.h in a subdirectory rather than directly in /usr/include.
I think I have built this in the past. I could take another look later.
Without downloading source, you just need to set some environment variables. For me, this was
export NETCDF_INCLUDE=/usr/include
After doing this, install.packages("ncdf") worked.
This is described in the INSTALL file.

Resources