Trouble Installing qdap package into R - 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!

Related

Cannot install vroom under R.4.0.5 on HPC node

To install another package that depends on vroom (which failed) on a HPC node, I sought to install vroom manually.
I tried to install the package manually but it fails too:
My code:
install.packages("vroom")
error message:
installing to /home/leuph1/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-vroom/00new/vroom/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘vroom’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/leuph1/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-vroom/00new/vroom/libs/vroom.so':
/home/leuph1/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-vroom/00new/vroom/libs/vroom.so: undefined symbol: __cxa_init_primary_exception
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/leuph1/R/x86_64-pc-linux-gnu-library/4.0/vroom’
Warning in install.packages :
installation of package ‘vroom’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpgPcp9Y/downloaded_packages’
I have tried under different R versions (3.5.3 up to 4.1.1) but keep having the same issue no matter what version I chose.
I have also deleted any 00LOCK-"package-name" folder that might have arisen in the process in the corresponding R Version package folder, but to no avail.
Can anybody help me out here?
Many thanks in advance,
Philibertus88

R package doesn't install from github

I am using RStudio with R (Version 4.0.2) and I am trying to install this climate package from github: https://github.com/SantanderMetGroup/climate4R
when I type: install_github("SantanderMetGroup/climate4R")
I get this error:
Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
Not Found
Did you spell the repo owner (`SantanderMetGroup`) and repo name (`climate4R`) correctly?
- If spelling is correct, check that you have the required permissions to access the repo.
I also downloaded the zipped package and tried to manually install the package within rstudio and got this error:
Installing package into ‘C:/Users/...../Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open compressed file 'climate4R-master/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
Why is it not installing? I have downloaded packages from github before with no problems.
UPDATED HERE:
I had already tried what is suggested below, but it also didn't work. I wanted to check first if I had missed something and it was possible to download the package all at once. When I input this:
library(devtools)
install_github(c("SantanderMetGroup/loadeR.java",
"SantanderMetGroup/climate4R.UDG",
"SantanderMetGroup/loadeR",
"SantanderMetGroup/transformeR",
"SantanderMetGroup/visualizeR",
"SantanderMetGroup/downscaleR"))
I get the following error:
Downloading GitHub repo SantanderMetGroup/loadeR.java#HEAD
√ checking for file 'C:\Users\...\AppData\Local\Temp\RtmpCAqAGF\remotes39b87d2f4f9\SantanderMetGroup-loadeR.java-88da23e/DESCRIPTION' ...
- preparing 'loadeR.java':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'loadeR.java_1.1.1.tar.gz'
Installing package into ‘C:/Users/.../Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
* installing *source* package 'loadeR.java' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading Error: package or namespace load failed for 'rJava': .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry Error: package 'rJava' could not be loaded Execution halted ERROR: lazy loading failed for package 'loadeR.java'
* removing 'C:/Users/.../Documents/R/win-library/4.0/loadeR.java' Error: Failed to install 'loadeR.java' from GitHub: (converted from warning) installation of package ‘C:/Users/.../AppData/Local/Temp/RtmpCAqAGF/file39b86ae96acb/loadeR.java_1.1.1.tar.gz’ had non-zero exit status
As already pointed out, the GitHub Repo is not an R package by itself.
Here from their GitHub Readme how to install their collection of packages that form the climate4R toolset.
library(devtools)
install_github(c("SantanderMetGroup/loadeR.java",
"SantanderMetGroup/climate4R.UDG",
"SantanderMetGroup/loadeR",
"SantanderMetGroup/transformeR",
"SantanderMetGroup/visualizeR",
"SantanderMetGroup/downscaleR"))
In order to install this package, I had to install this:JDK 13
https://www.oracle.com/java/technologies/javase-jdk13-downloads.html
This allowed each of the packages to be installed correctly.

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.

coreNLP & rJava installation issue from gitbub in 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

R packages: RCurl and curl packages install failure on Linux

I hope you can help with this issue I have come across whilst installing RCurl and curl packages for R.
Rd warning: /tmp/RtmpOBkvFC/R.INSTALLd07e6c06faf4/RCurl/man/url.exists.Rd:5: missing file link ‘file.exists’
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl/libs/RCurl.so':
/lib64/libgssapi_krb5.so.2: symbol krb5int_buf_len, version krb5support_0_MIT not defined in file libkrb5support.so.0 with link time reference
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl’
The downloaded source packages are in
‘/tmp/RtmpX6poG4/downloaded_packages’
Warning message:
In install.packages(pkgs = pkgs, lib = lib, repos = repos, ...) :
installation of package ‘RCurl’ had non-zero exit status`
That looks like that you have different versions of libcurl.
One approch could be the following one (for your console):
wget https://cran.r-project.org/src/contrib/curl_0.9.7.tar.gz
R CMD INSTALL curl_0.9.7.tar.gz --no-test-load
ldd /home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/curl/libs/curl.so
Then you can use ldd libcurl.so to find all dependencies and shared libraries to this.
Perhaps you can find some errors and/or you have to create a new LD_LIBRARY_PATH.
Good Luck!
J_F

Resources