No library trees found in 'lib.loc' when installing custom package - r

I am making a package for functions that I developed for a specific application at work. I was using a guide to make the package using devtools and roxygen2. see guide here https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/
When finished following the steps I used the install() feature and I get this error.
* installing *source* package 'subOpti' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE,
logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
*** arch - x64
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE,
logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing '\\server/users/lgallaway/My Documents/R/win-
library/3.3/subOpti'
My lib location is on a server and I choose my package location in a different section of a fileserver. I thought that maybe the server locations were an issue, so I moved the package locally but that just generated a separate error.

Well I took the files home and followed the same process that was highlighted in the guide above and it worked no issue. I am assuming the issue is that I don't have write permissions to the network lib location.

Related

Error installing the R package: CBNplot on github

I want to install the CBNplot package on GitHub:
Making the website:https://github.com/noriakis/CBNplot
Try two methods:
The first is direct download:
The following error occurs:
devtools::install_github("noriakis/CBNplot")
Installing package into ‘C:/Users/sjadsqf/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
installing source package 'CBNplot' ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
Execution halted
ERROR: lazy loading failed for package 'CBNplot'
removing 'C:/Users/sjadsqf/Documents/R/win-library/4.1/CBNplot'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/sjadsqf/AppData/Local/Temp/RtmpMHHiTR/file555833c63074/CBNplot_0.99.2.tar.gz’ had non-zero exit status
Then I tried the second method
pkgbuild::build("D:/R/CBNplot-main",
dest_path = "D:/R/library/")
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
Execution halted
ERROR: lazy loading failed for package 'CBNplot'
removing 'C:/Users/sjadsqf/AppData/Local/Temp/Rtmp2F15K6/Rinst5c845a222d2f/CBNplot'
-----------------------------------
ERROR: package installation failed
Error in (function (command = NULL, args = character(), error_on_status = TRUE, ...:
! System command 'Rcmd.exe' failed
Exit status: 1
stdout & stderr:
i notice that error
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
So I tried to install belearn,After the installation is complete, the above error still appears in the operation
If you look at the changelog for the package bnlearn, it says
Version 4.8
...
removed choose.direction().
The lastest version of bnlearn therefore does not have the choose.direction function that the earlier versions had. Obviously, the CBNplot package uses this function, so the update in bnlearn has effectively broken the existing version of CBNplot.
The solution is to install an earlier version of bnlearn. For example, if I do
remove.packages('bnlearn')
devtools::install_version('bnlearn', version = '4.7')
devtools::install_github("noriakis/CBNplot")
and skip any package updates that are offered, I can install the package without difficulties.

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

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!

Force devtools::install_github to install only 32-bit versions of packages?

Goal: I want to install dssrip package for R 3.6.0 32-bit on Windows 10 Enterprise.
I have both 32- and 64-bit versions of R 3.6.0 installed. In RStudio (1.2.1522), I set the default version to 32-bit then create new project with packrat enable. I included the following lines in the .Rprofile file inside project folder.
#### -- Packrat Autoloader (version 0.5.0) -- ####
source("packrat/init.R")
#### -- End Packrat Autoloader -- ####
dir.create("packages", recursive = TRUE, showWarnings = FALSE)
.libPaths("./packages")
message("Using library: ", .libPaths()[1])
options(dss_jre_location="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
Installation:
install.packages(c("devtools", "rJava", "plyr", "reshape2", "stringr", "tidyverse"),
dependencies = TRUE)
library(rJava)
devtools::install_github("eheisman/DSS-Rip",
args = "--no-multiarch")
Error:
Installing package into ‘C:/Users/user007/Documents/ttn/R/Projects/dssrip/packages’
(as ‘lib’ is unspecified)
* installing *source* package 'dssrip' ...
** using staged installation
** R
** demo
** byte-compile and prepare package for lazy loading
Note: possible error in 'month(d, label = TRUE, ': unused arguments (label = TRUE, abbr = TRUE)
** help
*** installing help indices
converting help for package 'dssrip'
finding HTML links ... done
AF_PER_CFS_DAY html
dss_path_functions html
fixTimestamps html
getColumnsByName html
getDT html
getFullDT html
getFullTSC html
getLooseTSC html
getMetadata html
getTSC html
hydro_axis_trans html
hydrologic_date_functions html
initialize.dssrip html
model_error_measurement html
nash.sutcliffe html
opendss html
rmse html
tsc.to.dt html
tsc.to.xts html
weibullProbs html
xts.to.tsc html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object
'C:/Users/user007/Documents/ttn/R/Projects/dssrip/packages/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error : package 'rJava' could not be loaded
Error: loading failed
Execution halted
ERROR: loading failed for 'x64'
* removing 'C:/Users/user007/Documents/ttn/R/Projects/dssrip/packages/dssrip'
Error in i.p(...) :
(converted from warning) installation of package
‘C:/Users/user007/AppData/Local/Temp/Rtmp8UP9Mb/file2d9c5e446300/dssrip_0.1.tar.gz’ had non-zero exit status
Java version:
C:\Program Files (x86)\HEC\HEC-DSSVue\java\bin>java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
C:\Program Files (x86)\HEC\HEC-DSSVue\java\bin>java -d64
Unrecognized option: -d64
Could not create the Java virtual machine.
I tried using the native R (C:\Program Files\R\R-3.6.0\bin\i386\Rgui.exe) but it did not help either.
Thanks in advance for any pointer!
Update 2: dssrip has been updated to work with 64-bit r and java. You will need a 64-bit compatible version of HEC-DSSVue (e.g., v3.2.3).
Update: I had to uninstall and delete everything and started from scratch to make dssrip work.
Put the following lines in the .Rprofile file:
options(dss_jre_location="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
Install all dependencies:
install.packages(c("remotes", "rJava", "data.table", "plyr", "reshape2", "stringr", "tidyverse"),
dependencies = TRUE)
Note that to force R to install only 32-bit version, I had to use this syntax instead:
remotes::install_github("eheisman/dssrip",
INSTALL_opts = "--no-multiarch")
Have you tried using RStudio -> Tool -> General, then click on "change" button on top that allows you to change the R-Version. A pull-down menu opens where you can select the 32-bit Version and activate it. You will have to restart RStudio to make it happen, though.

Build R package on Mac for Windows

I develop a package under Mac and want to distribute it to my colleagues. I can build the package under Mac and can install it under Mac and 'most' of my colleagues Windows PCs. Some of these are Windows 7 and some are Windows 8. All of them use RStudio and different R Versions all above 3.1.
I have now one big Problem with one computer and can not figure out what to do.
When I try to install the package, I get the following message
install.packages("C:/Users/ncasasvi/Downloads/imbproteomicsr_0.1.6.tar.gz", repos = NULL, type = "source", lib="\\fs02/ncasasvi$/Dokumente/R/R-3.1.2/library")
Warning in install.packages :
'lib = "\fs02/ncasasvi$/Dokumente/R/R-3.1.2/library"' is not writable
'\\fs02\ncasasvi$\Dokumente'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
'\\fs02\ncasasvi$\DOKUME~1\R\R-31~1.2' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"//fs02/ncasasvi$/DOKUME~1/R/R-31~1.2/bin/x64/R" CMD INSTALL -l "\\fs02\ncasasvi$\Dokumente\R\win-library\3.1" "C:/Users/ncasasvi/Downloads/imbproteomicsr_0.1.6.tar.gz"' had status 1
Warning in install.packages :
installation of package 'C:/Users/ncasasvi/Downloads/imbproteomicsr_0.1.6.tar.gz' had non-zero exit status
I copied now the complete package source, so all folders and files, to a Windows machine, installed Rtools and devtools there and build the package on the windows machine with the same problem...
Is there a way to geht a more precise error message, not just status one? I have no further Ideas.
I also sensed my file to win builder. It reported no error messages, but I also didn't got a 'new build package' from the website.
Hope some of you have some suggestions. Thanks in advance!
EDIT:
After changing the path to something without \\ at the beginning and trying to get rid of all the other error messages, I got this message:
> install.packages("C:/Users/ncasasvi/Downloads/imbproteomicsr_latest.tar.gz", repos = NULL, type = "source", lib=('U:/Dokumente/R/win-library/'))
Error: ERROR: no packages specified
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.2/bin/x64/R" CMD INSTALL -l "U:\Dokumente\R\win-library\" "C:/Users/ncasasvi/Downloads/imbproteomicsr_latest.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/ncasasvi/Downloads/imbproteomicsr_latest.tar.gz’ had non-zero exit status
In between, I had a partly success, but it still could not install the package. This was the output in between:
> install.packages("C:/Users/ncasasvi/Downloads/imbproteomicsr_latest (2).tar.gz", repos = NULL, type = "source")
Installing package into ‘\\fs02/ncasasvi$/Dokumente/R/win-library/3.1’
(as ‘lib’ is unspecified)
'\\fs02\ncasasvi$\Dokumente'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'imbproteomicsr' ...
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
*** arch - x64
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing '\\fs02/ncasasvi$/Dokumente/R/win-library/3.1/imbproteomicsr'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.2/bin/x64/R" CMD INSTALL -l "\\fs02\ncasasvi$\Dokumente\R\win-library\3.1" "C:/Users/ncasasvi/DOWNLO~1/imbproteomicsr_latest (2).tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/ncasasvi/DOWNLO~1/imbproteomicsr_latest (2).tar.gz’ had non-zero exit status

Resources