Error devtools::check - .onLoad failed in loadNamespace() for 'pillar' - r

Im building an R package and when testing the package using devtools::check() I get an error when the test reaches the installation phase, saying:
Error: .onLoad failed in loadNamespace() for 'pillar', details:
call: utils::packageVersion("vctrs")
error: there is no package called 'vctrs'
Execution halted
ERROR: lazy loading failed for package
Neither pillar nor vctrs are mentioned in my description file, so they must be dependents of some other package that I depend on. Both pillar and vctrs are installed and I've also tried reinstalling them. They are stored in the the first .libPath entry. I tried installing pillar from github as was suggested by mfox9 here, but this failed for me, giving this error:
> devtools::install_github("r-lib/pillar")
Downloading GitHub repo r-lib/pillar#master
√ checking for file 'C:\Users\DESCRIPTION' (337ms)
- preparing 'pillar': (664ms)
√ checking DESCRIPTION meta-information ...
- installing the package to process help pages
- checking for LF line-endings in source and make files and shell scripts (8.5s)
- checking for empty or unneeded directories
- building 'pillar_1.4.2.9001.tar.gz'
Installing package into ‘Z:/’
(as ‘lib’ is unspecified)
The filename, directory name, or volume label syntax is incorrect.
Error: Failed to install 'pillar' from GitHub:
(converted from warning) installation of package ‘C:/Users/Temp/RtmpgjFfZl/file32586b634e28/pillar_1.4.2.9001.tar.gz’ had non-zero exit status
(note: z:/ is my correct R library address)
Can someone please help?
´´´
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pillar_1.4.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 usethis_1.5.1
[5] devtools_2.2.0 pkgload_1.0.2 R6_2.4.0 rlang_0.4.0
[9] tools_3.6.1 pkgbuild_1.0.5 DT_0.8 packrat_0.5.0
[13] sessioninfo_1.1.1 cli_1.1.0 withr_2.1.2 remotes_2.1.0
[17] htmltools_0.3.6 ellipsis_0.2.0.1 assertthat_0.2.1 digest_0.6.20
[21] rprojroot_1.3-2 crayon_1.3.4 processx_3.4.1 callr_3.3.1
[25] fs_1.3.1 htmlwidgets_1.3 ps_1.3.0 curl_4.0
[29] testthat_2.2.1 glue_1.3.1 memoise_1.1.0 compiler_3.6.1
[33] desc_1.2.0 backports_1.1.4 prettyunits_1.0.2
´´´

Related

Fail to install tdplyr package. error: argument is not an environment

thanks for checking out my very first post. please bear with my formatting.
Issue summary: I have been using tdplyr to access teradata database with no issue until I tested another package called dplyr.teradata for potential performance enhancement. However I can no longer connect to the database due to the following error messages:
Error: package or namespace load failed for 'tdplyr':.onLoad failed
in loadNamespace() for 'tdplyr', details:
call: parent.env(from)
error: argument is not an environment
so I deleted the dplyr.teradata package, thought that would allow my original tdplyr to work, but I still get the same error message above. then I deleted the tdplyr package without backup, trying to reinstall using the original script below:
install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-
project.org'))
but fail to install because of the same error again. Hope someone could advise on fix.
My sessioninfo is below:
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rlang_0.4.10 teradatasql_17.0.0.8 odbc_1.3.0 dplyr_1.0.2
[5] dbplyr_2.0.0 digest_0.6.27 DBI_1.1.0 hms_0.5.3
[9] bit64_4.0.5 bit_4.0.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.13 magrittr_1.5 tidyselect_1.1.0 R6_2.4.1
[6] blob_1.2.1 tools_4.0.3 xfun_0.20 tinytex_0.28 ellipsis_0.3.1
[11] assertthat_0.2.1 tibble_3.0.4 lifecycle_0.2.0 crayon_1.3.4 zip_2.1.1
[16] purrr_0.3.4 vctrs_0.3.6 glue_1.4.2 openxlsx_4.2.3 stringi_1.5.3
[21] compiler_4.0.3 pillar_1.4.6 generics_0.0.2 pkgconfig_2.0.3
found the answer myself. Pasting the answer below.
The Teradata R package is incompatible with dbplyr v2.0.0 and its later versions, which introduced some breaking changes. To use tdplyr, the version of dbplyr package must be v1.4.4. tdplyr should be installed using the following commands from your Terminal (for Linux and Mac) or Command Prompt (for Windows), till a new version that is compatible with dbplyr v2.0.0 and its later versions is released:
Install dbplyr v1.4.4 first. There are various ways to install a specific version of a R package. Teradata recommends using the following command:
Rscript -e "remotes::install_version('dbplyr',version='1.4.4',repos='https://cloud.r-project.org')"
Note: To run this above command, the R package remotes should be present on the client machine.
Next to download and install tdplyr and dependencies automatically, if minimum required versions are not met, specify the Teradata R package repository and CRAN in the repos argument for install.packages.
Rscript -e "install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-project.org'))"

Unable to run packages from GitHub in R using devtools

Every time I try to download a package from GitHub using devtools I get an error. I'm currently trying to open the elan package:
library(devtools)
devtools::install_github("dalejbarr/elan")
I get the following error:
Installing package into ‘C:/Users/Daniel &
Catherine/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
Error: no packages specified The system cannot find the path
specified. Error: Failed to install 'elan' from GitHub: (converted
from warning) installation of package
‘C:/rtemp/Rtmp0gabkG/file5580567f6ac9/elan_0.1.tar.gz’ had non-zero
exit status
I've tried the solutions suggested here and here, but neither fix the problem. I understand that there might be a problem with the spaces in the path name, but there's not much I can do about that (I don't want to set up a new user on my computer just to run devtools).
My SessionInfo() is:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.2.2 usethis_1.5.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 pkgload_1.0.2 R6_2.4.0 rlang_0.4.0 tools_3.6.1 pkgbuild_1.0.3 sessioninfo_1.1.1 cli_1.1.0 withr_2.1.2 ellipsis_0.3.0
[13] remotes_2.1.1 assertthat_0.2.1 digest_0.6.21 rprojroot_1.3-2 crayon_1.3.4 processx_3.4.0 callr_3.3.0 fs_1.3.1 ps_1.3.0 curl_3.3 testthat_2.2.1 memoise_1.1.0
[25] glue_1.3.1 compiler_3.6.1 desc_1.2.0 backports_1.1.5 prettyunits_1.0.2
Looking at the source code at https://github.com/dalejbarr/elan/blob/master/DESCRIPTION I found a potential error of format. You could try to clone the repository and debug it manually by removing the extra spaces in front on the XML package import :
DESCRIPTION file
Package: elan
Title: Read ELAN XML files
Version: 0.1
Authors#R: "Dale Barr <dalejbarr3#gmail.com> [aut, cre]"
Description: Read ELAN XML files to tidy output
Depends:
R (>= 3.1.1),
dplyr
Imports:
XML,
plyr
License:
LazyData: true
RoxygenNote: 7.0.2
I tried it in a minimal package and this raise a problem (but the package still compiles without the scripts).
Alternatively you could use the XML(which this small package uses) or the xml2 (as here) package to parse your XML files.

R lme4ord installation error: "Error: object ‘sigma’ is not exported by 'namespace:lme4'"

I am trying to install lme4ord from github and receiving the following error:
remotes::install_github("stevencarlislewalker/lme4ord")
Downloading GitHub repo stevencarlislewalker/lme4ord#master
checking for file ‘/tmp/RtmpngUWJn/remotes2a0c5ce3f7b/stevencarlislewalker-lme4ord-5f62664/DESCRIP✔ checking for file ‘/tmp/RtmpngUWJn/remotes2a0c5ce3f7b/stevencarlislewalker-lme4ord-5f62664/DESCRIPTION’ (625ms)
─ preparing ‘lme4ord’:
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘lme4ord_0.0-3.tar.gz’
Installing package into ‘/home/localuserdir/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package ‘lme4ord’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘sigma’ is not exported by 'namespace:lme4'
Execution halted
ERROR: lazy loading failed for package ‘lme4ord’
* removing ‘/home/localuserdir/R/x86_64-redhat-linux-gnu-library/3.6/lme4ord’
Error: Failed to install 'lme4ord' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpngUWJn/file2a0c7b718e3a/lme4ord_0.0-3.tar.gz’ had non-zero exit status
My sessionInfo is:
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 30 (Workstation Edition)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] remotes_2.1.0 lme4_1.1-21 Matrix_1.2-17
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 magrittr_1.5 splines_3.6.0 MASS_7.3-51.4
[5] lattice_0.20-38 R6_2.4.0 minqa_1.2.4 tcltk_3.6.0
[9] tools_3.6.0 pkgbuild_1.0.3 grid_3.6.0 nlme_3.1-139
[13] cli_1.1.0 withr_2.1.2 assertthat_0.2.1 rprojroot_1.3-2
[17] crayon_1.3.4 processx_3.4.1 nloptr_1.2.1 callr_3.3.1
[21] ps_1.3.0 curl_4.0 compiler_3.6.0 backports_1.1.4
[25] prettyunits_1.0.2 boot_1.3-22
I have seen some discussions of namespace interactions (whether sigma is loaded from base or lme4) in earlier versions (3.2 or less) of R, but everything here should be up to date.
Any ideas?

R Windows: Error installing package 'rvest' (and several other packages)

I am trying to install packages in a fresh install of R in Visual Studio 2017. Some packages will install, but several give me the same error. An example is the 'rvest' package. When I try install.packages("rvest")
install.packages("rvest")
Installing package into ‘C:/Users/Sean/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
rvest 0.3.2 0.3.3 FALSE
installing the source package ‘rvest’
trying URL 'https://mran.microsoft.com/snapshot/2019-04-15/src/contrib/rvest_0.3.3.tar.gz'
Content type 'application/octet-stream' length 1631059 bytes (1.6 MB)
downloaded 1.6 MB
In R CMD INSTALL
The downloaded source packages are in
‘C:\Users\Sean\AppData\Local\Temp\RtmpmuXBs1\downloaded_packages’
Warning message:
In utils::install.packages(...) :
installation of package ‘rvest’ had non-zero exit status
This happens also in 'rcmdcheck':
> install.packages("rcmdcheck")
Installing package into ‘C:/Users/Sean/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
rcmdcheck 1.3.1 1.3.2 FALSE
installing the source package ‘rcmdcheck’
trying URL 'https://mran.microsoft.com/snapshot/2019-04-15/src/contrib/rcmdcheck_1.3.2.tar.gz'
Content type 'application/octet-stream' length 1408582 bytes (1.3 MB)
downloaded 1.3 MB
In R CMD INSTALL
The downloaded source packages are in
‘C:\Users\Sean\AppData\Local\Temp\RtmpmuXBs1\downloaded_packages’
Warning message:
In utils::install.packages(...) :
installation of package ‘rcmdcheck’ had non-zero exit status
My sessionInfo() shows:
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] FSVRegimeDetection_0.0.0.9000 aTSA_3.1.2 autoimage_2.0 FSVPreselection_0.0.0.9000 FSVTradingRules_0.0.0.9000 FinancialInstrument_1.3.1 quantmod_0.4-14
[8] FSVIndicators_0.0.0.9000 dlm_1.1-5 PerformanceAnalytics_1.5.2 TTR_0.23-4 FSVPositionSizing_0.0.0.9000 FSVDataCheck_0.0.0.9000 xts_0.11-2
[15] zoo_1.8-5 FSVLibraryUtilities_0.0.0.9000 roxygen2_6.1.1 usethis_1.5.0 devtools_2.0.2 ldhmm_0.4.5 RevoUtils_11.0.3
[22] RevoUtilsMath_11.0.0
loaded via a namespace (and not attached):
[1] ecd_0.9.1 pkgload_1.0.2 bit64_0.9-7 moments_0.14 assertthat_0.2.1 rtvs_1.0.0.0 RcppFaddeeva_0.1.0 blob_1.1.1 yaml_2.2.0 remotes_2.0.4
[11] sessioninfo_1.1.1 numDeriv_2016.8-1 pillar_1.3.1 RSQLite_2.1.1 backports_1.1.4 lattice_0.20-38 glue_1.3.1 quadprog_1.5-5 digest_0.6.18 colorspace_1.4-1
[21] plyr_1.8.4 pkgconfig_2.0.2 purrr_0.3.2 xtable_1.8-3 scales_1.0.0 processx_3.3.0 tibble_2.1.1 gmp_0.5-13.5 ggplot2_3.1.1 withr_2.1.2
[31] lazyeval_0.2.2 Rmpfr_0.7-2 cli_1.1.0 magrittr_1.5 crayon_1.3.4 memoise_1.1.0 ps_1.3.0 fs_1.2.7 gsl_2.1-6 xml2_1.2.0
[41] pkgbuild_1.0.3 tools_3.5.3 prettyunits_1.0.2 stringr_1.4.0 munsell_0.5.0 stabledist_0.7-1 FSVBackTest_0.0.0.9000 callr_3.2.0 compiler_3.5.3 rlang_0.3.4
[51] grid_3.5.3 rstudioapi_0.10 testthat_2.0.1 gtable_0.3.0 curl_3.3 DBI_1.0.0 polynom_1.4-0 R6_2.4.0 gridExtra_2.3 knitr_1.22
[61] dplyr_0.8.0.1 optimx_2018-7.10 bit_1.1-14 commonmark_1.7 rprojroot_1.3-2 desc_1.2.0 stringi_1.4.3 parallel_3.5.3 Rcpp_1.0.1 tidyselect_0.2.5
[71] xfun_0.6
Any help tracking down the source of this issue would be greatly appreciated!
I was able to get these packages to load using
type = "binary"
argument in the install.packages() method call. Ie:
install.packages("rvest", type = "binary")
You can try to install the github version of the package using devtools, as below:
install.packages("devtools")
devtools::install_github("tidyverse/rvest")

R cannot load package forecast due to namespace error

I tried installing all the dependant packages and also tried another repo source as recommended in another post here.
R version 3.2.0 x64
install.packages("fracdiff")
install.packages("Rcpp")
install.packages("RcppArmadillo")
install.packages("colorspace")
install.packages("forecast", dep=T)
install.packages("forecast", repos=c("http://cran.rstudio.com"),dep=T)
library("forecast")
then I get
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: timeDate
Error : .onAttach failed in attachNamespace() for 'forecast', details:
call: fun(libname, pkgname)
error: 4 arguments passed to .Internal(nchar) which requires 3
In addition: Warning message:
package ‘forecast’ was built under R version 3.2.1
Error: package or namespace load failed for ‘forecast’
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] Hmisc_3.16-0 ggplot2_1.0.1 Formula_1.2-1 survival_2.38-1 lattice_0.20-31 zoo_1.7-12 timeSeries_3012.99 timeDate_3012.100
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 cluster_2.0.1 magrittr_1.5 MASS_7.3-41 splines_3.2.0 forecast_6.1 munsell_0.4.2
[8] colorspace_1.2-6 quadprog_1.5-5 stringr_1.0.0 plyr_1.8.3 tools_3.2.0 nnet_7.3-9 parallel_3.2.0
[15] gtable_0.1.2 latticeExtra_0.6-26 tseries_0.10-34 digest_0.6.8 gridExtra_0.9.1 RColorBrewer_1.1-2 reshape2_1.4.1
[22] acepack_1.3-3.3 rpart_4.1-9 fracdiff_1.4-2 stringi_0.4-1 scales_0.2.5 foreign_0.8-63 proto_0.3-10
I tried to reproduce. I get no message about either loading timeDate or the error you see. I do get a message about loading pkg:zoo. The package loads and announces its version number. Try updating to R version 3.2.1, since that is where a new argument to nchar was introduced:
new$Text[ grep("nchar", news$Text) ]
• nchar(x, *) and nzchar(x) gain a new argument keepNA which governs how the result for NAs in x is determined. For the R 3.2.x series, the default remains FALSE which is fully back compatible. From R 3.3.0, the default will change to keepNA = NA and you are advised to consider this for code portability.

Resources