Failing TravisCI due to rJava - r

Summary
TravisCI build suddenly fails, possibly due to some rJava shenanigans. Local checks (Linux) are squeaky-clean.
Preamble
My package was building fine on Travis up until 2 months ago, this is the last successful build.
The next build only changed some minor things on README.md (which is even on .Rbuildignore), but TravisCI started failing anyway. This makes me think that all I need to do is adjust .travis.yml accordingly. I've tried every tweak I could find (here's the commit history of the file).
How far I got
The best I could manage so far is to narrow down the error to either this:
The command "sudo R CMD javareconf" failed and exited with 1 during .
or this:
checking whether JNI programs run... configure: error: Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason.
Error in system(cmd) : (converted from warning) error in running command
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: ... with_rprofile_user -> with_envvar -> force -> force -> i.p
Execution halted
The command "Rscript -e 'deps <- remotes::dev_package_deps(dependencies = >NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% >installed.packages())) { message("missing: ", paste(setdiff(deps$package, >installed.packages()), collapse=", ")); q(status = 1, save = "no")}'" failed and exited with 1 >during .
The full log of both errors can be found here and here, respectively.

Related

Strange `tinytex` behavior - `~/.TinyTex` keeps dissapearing?

In my rocker/rstudio-derived docker container, I'm engulfed in a quagmire surrounding the yearly TexLive update and the R package tinytex.
I have gone through a plethora of iterations of tinytex::install_tinytex(), tinytex::uninstall_tinytex(), tinytex::reinstall(), etc.
I have installed the most current version via remotes::install_github("yiuhi/tinytex").
I have experimented with different (up to date) mirrors of CTAN.
When using a up to date mirror and having installed/reinstalled tinytex properly, I keep getting this behavior:
> tinytex::tinytex_root()
[1] "/home/rstudio/.TinyTeX"
> tinytex::pdflatex("<MYFILE>.tex")
tlmgr: package repository http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/systems/texlive/tlnet (verified)
[1/1, ??:??/??:??] install: koma-script [13745k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /home/rstudio/.TinyTeX/texmf-var/web2c/tlmgr.log
... 6 more successful package installs ...
tlmgr: package repository http://vesta.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/systems/texlive/tlnet (verified)
[1/1, ??:??/??:??] install: babel-english [3k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /home/rstudio/.TinyTeX/texmf-var/web2c/tlmgr.log
! LaTeX Error: This NFSS system isn't set up properly.
! sh: 1: pdflatex: not found
Error: LaTeX failed to compile <MYFILE>.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See <MYFILE>.log for more info.
In addition: Warning messages:
1: In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
error in running command
2: In system2("tlmgr", args, ...) : error in running command
> tinytex::tinytex_root()
[1] ""
After this, ~/.TinyTeX (which was present before) is literally GONE from the file system!?
Can anybody shed light on why 1) tinytex appears to install, 2) it appears to properly process my *.tex file and pulling in the appropriate packages from CTAN and than 3) proceeds in one of those package installations to delete it's entire own installation!?
The observed behavior was a bug in the tinytex R package and has since been resolved (https://github.com/yihui/tinytex/issues/197).
Until the CRAN-available version is >= 0.21.5, one may remedy the behavior by installing directly from the author's repository by:
install.packages("remotes")
remotes::install_github("yihui/tinytex")

Error installing RODBC or ODBC on a Sagemaker Jupyter NoteBook Instance

I have been trying to establish a connection to Teradata from a Sagemaker Jupyter Notebook instance. I was trying to do it the way I would through R Studio. But when ever I try to install the package in the instance I get an non-zero exit status error.
I have tried installing the following ways:
remotes::install_github()
or
devtools::install_github()
and also:
install.packages('odbc', repo="https://cran.rstudio.com/")
I tryed the same with RODBC, and I get the same warnings or errors.
Any ideas on how I can get around this problem?
Thanks in advance.
UPDATE:
If I run this line of code:
devtools::install_github("r-dbi/odbc")`
I get the following error (This is just an extract):
Error: Failed to install 'odbc' from GitHub:
System command error, exit status: 1, stdout + stderr (last 10 lines):
E> ** testing if installed package can be loaded from temporary location
E> Error: package or namespace load failed for ‘odbc’ in dyn.load(file, DLLpath = DLLpath, ...):
E> unable to load shared object '/tmp/RtmpBuMhbW/Rinst32846cdd20a9/00LOCK-odbc/00new/odbc/libs/odbc.so':
E> libodbc.so.2: cannot open shared object file: No such file or directory
E> Error: loading failed
E> Execution halted
E> ERROR: loading failed
E> * removing ‘/tmp/RtmpBuMhbW/Rinst32846cdd20a9/odbc’
E> -----------------------------------
E> ERROR: package installation failed
Traceback:
Alright, after hours of reading AWS/Sagemaker/Conda/R documentation I arrived at the conclusion that, I don't know how to explain the phenomena.
Nonetheless, I have found a workaround!
So we know how we can install packages through the Jupyter terminal or directly from a cell in the .ipynb file. Nonetheless, if you try to run those commands inside the R kernel just like you would on the terminal or in a Python kernel you would run into an error.
Also, for some people installing it in the terminal, or even on a Python kernel might just make conda install the package on a different environment. Yes, turns out there are a couple of environments on your Jupyter instance.
So, to get to the point, just like I said, you would use a conda install command, not a pip, sudo or yum command.
Make your life easier. Here is the code that you would need to run on your R Kernel cell, to install a package directly to the correct environment if, install.packages() and install_github() didn't work:
system(command = 'conda install -c r packageName --yes')
Example:
system(command = 'conda install -c r tidyverse --yes')
And that's it. After that you can call library() and resume your R workflow as you do.
Hope this helps guys!

Error in installing car package in R

While installing "car" package in Rstudio in Ubuntu, I faced an error saying that dependencies "nloptr","lme4" and one more, are not installed.
So I started installing "nloptr" but I faced this error-
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/RtmpSeLv7g/R.INSTALL18a67910d582/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
System hangs after last line and when I restart after some time, "nloptr" is not installed and hence I am unable to install "car" package.
Please help me. Thanks in advance.
I was encountering the same problem under R (pure R 3.2.3 on Linux Debian). I was first blocked by another issue during the same installation : the installation process failed to lock directory ~/.../R/x86_64.../3.2 and suggested to remove ~/.../R/x86_64.../3.2/00LOCK-nloptr . I did it, restart the car package installation, and then it blocked at the same point: it needs nlopt.h.
So, I installed libnlopt-dev (sudo apt-get install libnlopt-dev) and re-restart the car installation ... and then it worked.
Ok, this is under linux, but perhaps should you try to focus on installing something about NLOPT under windows.
Good luck.

Installing R Interface for Ipopt

I have exactly the same problem as the poster here, unfortunately no solution is provided on that link.
I built and installed IPOPT (version 3.12.6) on Windows 7 (64bit) with Cygwin, but I cannot seem to get the R interface to work. All commands (configure, make, make install, make test) were executed without error.
When I try to build the R interface from RStudio, I tried using both the code in the "build" folder as well as the code in the main directory. I get the following errors:
`>install.packages("C:/cygwin64/home/Ipopt-3.12.6/build/Ipopt/contrib/RInterface",
repos=NULL, type="source")
Error:
cygwin64/home/Ipopt-3.12.6/build/Ipopt/contrib/RInterface/DESCRIPTION'
Not using the build directory:
`>install.packages("C:/cygwin64/home/Ipopt-3.12.6/Ipopt/contrib/RInterface", repos=NULL, type="source")
Error:
installing source package 'ipoptr' ...
** libs
*** arch - i386 Warning: running command 'make -f "Makevars.win" -f "C:/Users/~1/DOCUME~1/R/R-33~1.1/etc/i386/Makeconf" -f
"C:/Users/~1/DOCUME~1/R/R-33~1.1/share/make/winshlib.mk"
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB="ipoptr.dll" ' had status 127 ERROR: compilation failed for
package 'ipoptr'
* removing 'C:/Users/Documents/R/R-3.3.1/library/ipoptr' Warning in install.packages : running command
'"C:/Users/~1/DOCUME~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l
"C:\Users\Documents\R\R-3.3.1\library"
"C:/cygwin64/home/Ipopt-3.12.6/Ipopt/contrib/RInterface"' had status 1
Warning in install.packages : installation of package
‘C:/cygwin64/home/Ipopt-3.12.6/Ipopt/contrib/RInterface’ had non-zero
exit status
Does anyone know what I could do to resolve this?
EDIT: After installing RTools and adding it to my PATH I get ipoptr.cpp:22:34: fatal error: IpIpoptApplication.hpp: No such file or directory
#include "IpIpoptApplication.hpp", i.e. it seems that ipoptr.cpp cannot find IpIpoptApplication.hpp (which is in a subdirectory of the build folder) and later on in the error still the same Warning: running command 'make -f "Makevars.win" -f ' had status 2.... Copying this file over to the location of ipoptr.cpp moves the error one file further to another similar file that it cannot find. I suspect it cannot find these files because of something being wrong with my makevars.win file (I suspect that that's the file that should point to the currently missing files). Does anyone have an idea what this could be?
EDIT 2: Might it have to do with the comment here indicating that in some cases LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$IPOPTDIR/build/lib should be set? How do I do this? Should this be done in R or cygwin?

Installing ggbiplot from github

I'm trying to install development version of ggbiplotfrom Github. During installation I'm getting the following error message:
library(devtools)
install_github("ggbiplot", "vqv")
Installing github repo(s) ggbiplot/master from vqv
Installing ggbiplot.zip from https://github.com/vqv/ggbiplot/zipball
Installing ggbiplot
* checking for file 'C:\Users\Muhammad Yaseen\AppData\Local\Temp\Rtmpsx4n5u\vqv-ggbiplot-2623d7c/DESCRIPTION' ... OK
* preparing 'ggbiplot':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'ggbiplot_0.5.tar.gz'
cygwin warning:
MS-DOS style path detected: C:/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
Preferred POSIX equivalent is: /cygdrive/c/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Warning: invalid package 'Yaseen/R/win-library/2.14'
Error: ERROR: cannot cd to directory 'C:/Users/Muhammad'
Error: Command failed (1)
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz --library=C:/Users/Muhammad Yaseen/R/win-library/2.14' had status 1
Any idea to figure out this problem. Thanks in advance for your help and time.
Edit
After downloading from Github, also tried
install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos=NULL, type="source")
which produced this error message
Installing package(s) into ‘C:/Users/Muhammad Yaseen/R/win-library/2.14’
(as ‘lib’ is unspecified)
Error in untar2(tarfile, files, list, exdir) : unsupported entry type 'g'
Warning messages:
1: running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL -l "C:/Users/Muhammad Yaseen/R/win-library/2.14" "vqv-ggbiplot-2623d7c.tar.gz"' had status 1
2: In install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos = NULL, :
installation of package ‘vqv-ggbiplot-2623d7c.tar.gz’ had non-zero exit status
It's because your Rlib path has a space in it: C:/Users/Muhammad Yasseen/R/win-library/2.14.
See how in the first error log the warning message was
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL
C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz
--library=C:/Users/Muhammad Yaseen/R/win-library/2.14'
had status 1
In particular, the --library=C:/Users/Muhammad Yaseen/R/win-library/2.14.
This should be --library="C:/Users/Muhammad Yaseen/R/win-library/2.14" to deal with the space.
Using install.packages takes care of the quotes for you - see how your second warning message (when you used install.packages) was
running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL
-l "C:/Users/Muhammad Yaseen/R/win-library/2.14"
"vqv-ggbiplot-2623d7c.tar.gz"' had status 1
The -l "C:/Users/Muhammad Yasseen/R/win-library/2.14" has quote marks around it, so you don't get the same error.
I had a quick look at the install-github sources, and it constructs the R CMD INSTALL command via:
paste("CMD INSTALL ", built_path, " --library=", .libPaths()[1], sep="")
See how it doesn't surround .libPaths()[1] by double quotes in case of spaces? I'd guess that's your problem.
As to a fix - there seems to be an error using install.packages() on a tar file generated by git (as reported here). So, you can either:
change your R library location to somewhere without spaces
unzip the .tar.gz file (I don't know what software does this on Windows) and install from the extracted directories rather than the .tar.gz.
You can't unzip the .tar.gz because it cleans up that file quicker than you can grab it (I've watched it appear and get deleted again). Correct me if I'm wrong, but I also can't get devtools from github for teh same reason :S

Resources