coreNLP & rJava installation issue from gitbub in R - r

fellow stackoverflowers!
I was trying to install coreNLP from github as there is a bug in the coreNLP package that comes with R.
Now while installing the coreNLP from github using below
To download the R library and corresponding CoreNLP java library, run the following in R:
devtools::install_github("statsmaths/coreNLP")
coreNLP::downloadCoreNLP()
I got an error
installing source package 'coreNLP' ...
** R
** data
* moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
* installing help indices
** building package indices
** testing if installed package can be loaded
* arch - i386
Error: package or namespace load failed for 'coreNLP':
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures.
Error: loading failed
Execution halted
* arch - x64
ERROR: loading failed for 'i386'
removing 'C:/Users/animshru/Documents/R/win-library/3.4/coreNLP'
Installation failed: Command failed (1)
After looking at many suggestions what I understood was
i) I was missing the class file path for Java Home and added the same and tried installing coreNLP again.
Sys.setenv(JAVA_HOME='C:/Program Files/Java/jre1.8.0_121')
devtools::install_github("statsmaths/coreNLP")
This time the error generated relates to the package/library rJava as seen below
Downloading GitHub repo statsmaths/coreNLP#master
from URL https://api.github.com/repos/statsmaths/coreNLP/zipball/master
Installing coreNLP
"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
"C:/Users/XYZ/AppData/Local/Temp/RtmpieUxG6/devtools3c0456877ca/statsmaths-coreNLP-caee22e" \
--library="C:/Users/XYZ/Documents/R/win-library/3.4" --install-tests
installing source package 'coreNLP' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/XYZ/Documents/R/win-library/3.4/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
ERROR: lazy loading failed for package 'coreNLP'
* removing 'C:/Users/XYZ/Documents/R/win-library/3.4/coreNLP'
Installation failed: Command failed (1)
I have installed the rJava package successfully and able to access the library for the same. Now I need to understand why I am getting this error of access issue to a rjava.dll file inside the package rJava.?
Has anyone encountered the same problem already??
I have double and triple checked the java version is 64bit same as the R.
Any hints folks??
Thanks

Related

Trouble Installing qdap package into R

I want to install "qdap" package to run a text mining project. I tried installing the package in many different ways:
1. intsall.packages("qdap")
2. Downloading the file locally then installing
3. Using devtools
library(devtools)
install_github("trinker/qdapDictionaries")
install_github("trinker/qdapRegex")
install_github("trinker/qdapTools")
install_github("trinker/qdap")
I always had the same problem. It seems to be related to rJava package. I tried to install rJava but I wasn't successful.
I'm more of a data analyst than a developer so I don't have much experience with development (using terminal commands or fixing java on my mac).
I'd really like to use this "qdap" package. Could you please help me figure out in a simple manner?
Here's the error message after I install the package:
The downloaded source packages are in
‘/private/var/folders/hk/r0tjy0t57n79lvkh2_fc7snm0000gn/T/RtmpsSJ6Mg/downloaded_packages’
✓ checking for file ‘/private/var/folders/hk/r0tjy0t57n79lvkh2_fc7snm0000gn/T/RtmpsSJ6Mg/remotes42b1730aa4f/trinker-qdap-7f390f7/DESCRIPTION’ (437ms)
─ preparing ‘qdap’: (1.1s)
✓ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts (1.3s)
─ checking for empty or unneeded directories
Removed empty directory ‘qdap/tools’
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘qdap_2.4.2.tar.gz’
* installing *source* package ‘qdap’ ...
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Warning in system("/usr/libexec/java_home", intern = TRUE) :
running command '/usr/libexec/java_home' had status 1
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
ERROR: lazy loading failed for package ‘qdap’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/qdap’
Error: Failed to install 'qdap' from GitHub:
(converted from warning) installation of package ‘/var/folders/hk/r0tjy0t57n79lvkh2_fc7snm0000gn/T//RtmpsSJ6Mg/file42b3e031f25/qdap_2.4.2.tar.gz’ had non-zero exit status
Maybe the key is in the following
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
and
Warning in system("/usr/libexec/java_home", intern = TRUE) :
running command '/usr/libexec/java_home' had status 1
Are you sure you have installed a JVM? And if yes, the correct one? Because it seems to not find it.
You can download JVM from here.
I hope this helps!

R: package installation trouble in Ubuntu

I'm running on Ubuntu 16.04 (on a Lenovo ThinkPak T450). I have installed R version 3.4.1, installed by following the instructions here via Rbloggers.
From here, I would like to start installing packages, but if I run R from the command line without root privileges, I cannot access a CRAN mirror. That is, when I run install.packages('dplyr') (or any install.packages('blah')) I get the following error
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.18/library ./tcl8.5.18/library
With that error, no CRAN mirror dialog box appears and hence no installation of packages. Note: this error does not happen when I start R with root privileges (i.e., start via > sudo R), but I do not want to install packages as root.
Thanks in advance for any help you can send my way!
Edit: Specifying the repo also results in error (in the file paths below, I replaced my user-name with user-name).
E.g.: install.packages('Rcpp',repos='http://cran.us.r-project.org') terminates with:
installing to /home/user-name/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/user-name/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so':
/home/user-name/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/user-name/R/x86_64-pc-linux-gnu-library/3.4/Rcpp’
E.g., install.packages('dplyr',repos='http://cran.us.r-project.org') terminates with:
installing to /home/user-name/R/x86_64-pc-linux-gnu-library/3.4/dplyr/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/user-name/R/x86_64-pc-linux-gnu-library/3.4/bindrcpp/libs/bindrcpp.so':
/home/user-name/anaconda3/lib/R/bin/exec/../../lib/../.././libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/user-name/R/x86_64-pc-linux-gnu-library/3.4/bindrcpp/libs/bindrcpp.so)
ERROR: lazy loading failed for package ‘dplyr’
* removing ‘/home/user-name/R/x86_64-pc-linux-gnu-library/3.4/dplyr’
As pointed out by DirkEddelbuettel in the comments, the issue was a mixing of Anaconda and R. To fix this problem:
I uninstalled the R packages from Anaconda by first looking at > conda list and realizing that the package was r-base; hence running > conda remove r-base.
Next, by looking at the output of > which R, it was clear that we were still trying to execute from the ../anaconda3/bin/.. directory. I suspect there is a quick way to change this via an export or bashrc amendment (or something similar), but for me, the quickest work-around was to run > sudo apt-get install r-base r-base-dev, which took all of 0.2 seconds as they were already installed, but it did affect the directory which the system looks in to the appropriate one, for me this is /usr/bin/R/.
From here I've been able to install everything I've needed.
Note: Thinking back, I suspect the "mixing" happened when I installed rpy2 via conda.

Error in installing Tabulizer

Using the instructions described in github and installing Java accordingly with Chocolatey -- plus installing rJava and setting the path in R with Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jdk1.8.0_131")-- I've done the following in R:
library(ghit)
library(git2r)
ghit::install_github(c("leeper/tabulizerjars", "leeper/tabulizer"), INSTALL_opts = "--no-multiarch", dependencies = c("Depends", "Imports"))
Which is the solution provided in this answer. I get the following error:
Error in git2r::init(d) :
Error in 'git2r_repository_init': Unable to init repository
Setting the option VERBOSE = TRUE in install_github I get the following additional output:
Parsing reponame for 'leeper/tabulizerjars'...
Creating local git repository for tabulizerjars in C:\Users\JOOCAR~1\AppData\Local\Temp\RtmpgnitDP\tabulizerjars1643e0126f5...
Error in git2r::init(d) :
Error in 'git2r_repository_init': Unable to init repository
I read this answer and it seems that it has to do with my username, which is spaced and has accents. But how do I configure this?
edit: 6/4/2017 1:57 am
Following user #jaySf answer, I run part of the code of his answer (since I've already installed rJava and devtools):
library(rJava) # load and attach 'rJava' now
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
And got the following error:
> library(rJava) # load and attach 'rJava' now
> devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
Downloading GitHub repo ropensci/tabulizer#master
from URL https://api.github.com/repos/ropensci/tabulizer/zipball/master
Installing tabulizer
Downloading GitHub repo ropensci/tabulizerjars#master
from URL https://api.github.com/repos/ropensci/tabulizerjars/zipball/master
Installing tabulizerjars
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo \
Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c50925145/ropensci-tabulizerjars-c6cc40e" --library="C:/R-3.4.0/library" --install-tests
* installing *source* package 'tabulizerjars' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'tabulizerjars':
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/R-3.4.0/library/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/R-3.4.0/library/tabulizerjars'
Installation failed: Command failed (1)
"C:/R-34~1.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "C:/Users/Joo \
Caos/AppData/Local/Temp/Rtmpgh9eJi/devtoolsb3c4a2835ec/ropensci-tabulizer-a38d957" --library="C:/R-3.4.0/library" --install-tests --no-multiarch
ERROR: dependency 'tabulizerjars' is not available for package 'tabulizer'
* removing 'C:/R-3.4.0/library/tabulizer'
Installation failed: Command failed (1)
I believe that I might have a problem with my username in the file directory path, but I'm not sure. I tried using install_github with ggplot2 --`install_github("wch/ggplot2") -- and it worked fine. If my guess is correct, how can I edit the file path?
Problem solved
I was running R with both 32 bit and 64 bit files installed. I cannot clearly state what were the problems in doing this, since as I ran Sys.getenv("R_ARCH") it returned x64 previously, but when I uninstalled the 32 bit files, it ran perfectly well with #jaySf code.
Follow these steps in given order should work:
install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
I'm using R 3.4.0 on win64, and described the procedure in a former answer.
install.packages("rJava")
library(rJava) # load and attach 'rJava' now
install.packages("devtools")
#run below package first..
devtools::install_github("ropensci/tabulizerjars", args="--no-multiarch")
devtools::install_github("ropensci/tabulizer", args="--no-multiarch")
You might try:
devtools::install_github("ropensci/tabulizerjars", INSTALL_opts = c("--no-multiarch"))
devtools::install_github("ropensci/tabulizer", INSTALL_opts = c("--no-multiarch"))

.onLoad failed in loadNamespace() for 'rClr'

I am trying to build a package which has the namespace files as follows:
exportPattern("^[[:alpha:]]+")
importFrom(rClr, clrLoadAssembly)
rClr is installed in my system.
I build my package using devtools::build and it successfully builds.
When I install the package using the following command install.packages("C:/Package/Utils_0.1.0.tar.gz", repos = NULL, type = "source")
I get the following error:
* installing *source* package 'Utils' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rClr', details:
call: fun(libname, pkgname)
error: 'msvcr120.dll' was not found on this Windows system.
You are probably missing the Visual C++ Redistributable for Visual Studio 2013.
Check instructions at https://r2clr.codeplex.com/wikipage?title=Installing%20R%20packages&referringTitle=Documentation
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/S.Bista/Documents/R/R-3.3.2/library/Utils'
* restoring previous 'C:/Users/S.Bista/Documents/R/R-3.3.2/library/Utils'
Warning in install.packages :
running command '"C:/Users/S~1.BIS/DOCUME~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\S.Bista\Documents\R\R-3.3.2\library" "C:/Package/Utils_0.1.0.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Package/Utils_0.1.0.tar.gz’ had non-zero exit status
Loading fails for i386 but I have x64 system.

Error in installing R Package "SqlRender"

I am new to R - Programming, I am trying to run "install_github("ohdsi/SqlRender")" on windows 7, 64-bit with jdk 7 (64- bit) and R version 3.1.2 and R-GUI (64-bit).
I am getting the following error:
> library("devtools")
Warning message:
package ‘devtools’ was built under R version 3.1.3
> install_github("ohdsi/SqlRender")
Downloading github repo ohdsi/SqlRender#master
Installing SqlRender
"C:/PROGRA~1/R/R-31~1.2/bin/x64/R" --no-site-file --no-environ --no-save -- no-restore CMD INSTALL \
"C:/Users/PPingali/AppData/Local/Temp/RtmpMtqVJl/devtools1318104472eb/OHDSI- SqlRender-cc551a2" \
--library="C:/Users/PPingali/Documents/R/win-library/3.1" --install-tests
* installing *source* package 'SqlRender' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/PPingali/Documents/R/win- library/3.1/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/PPingali/Documents/R/win-library/3.1/SqlRender'
Error: Command failed (1)
Please help me out in fixing this issue...
Thanks in advance.....
....................................................................
rJava package got installed perfectly...
when i run
library(rJava)
gives me no error.....
install.packages("SqlRender",INSTALL_opts = "--no-multiarch")
for some reason checks bost 32 and 64bit versions. even though I have correct x64 version of Java 1.8, R it still failed check i386 step. the INSTALL_opts flaf seems to bypass and then no issue

Resources