Fail to install older version of stringi using renv

233 Views Asked by At

I've been trying to install an older version of stringi using renv and am getting the following error. I've had a few earlier errors using restore, but a few restarts have been able to move things through. I tried removing and reinstalling stringi, but still end up with the same error when trying to load the appropriate version.

Installing stringi [1.4.3] ...
    FAILED
Error installing package 'stringi':
===================================

* installing *source* package 'stringi' ...
** package 'stringi' successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c stri_ICU_settings.cpp -o stri_ICU_settings.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c stri_TODO_justify.cpp -o stri_TODO_justify.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c stri_TODO_splitpos.cpp -o stri_TODO_splitpos.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c stri_TODO_uchar.cpp -o stri_TODO_uchar.o
g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.0/include" -DNDEBUG -I. -Iicu61/ -Iicu61/unicode -Iicu61/common -Iicu61/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DU_TOOLUTIL_IMPLEMENTATION -DNDEBUG -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DU_USE_STRTOD_L=0    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c stri_brkiter.cpp -o stri_brkiter.o
stri_brkiter.cpp: In member function 'void StriBrkIterOptions::setType(SEXP, const char*)':
stri_brkiter.cpp:60:8: error: 'isNull' was not declared in this scope; did you mean 'Rf_isNull'?
   60 |    if (isNull(opts_brkiter)) {
      |        ^~~~~~
      |        Rf_isNull
stri_brkiter.cpp: In member function 'void StriBrkIterOptions::setLocale(SEXP)':
stri_brkiter.cpp:130:8: error: 'isNull' was not declared in this scope; did you mean 'Rf_isNull'?
  130 |    if (isNull(opts_brkiter)) {
      |        ^~~~~~
      |        Rf_isNull
stri_brkiter.cpp: In member function 'void StriBrkIterOptions::setSkipRuleStatus(SEXP)':
stri_brkiter.cpp:171:8: error: 'isNull' was not declared in this scope; did you mean 'Rf_isNull'?
  171 |    if (isNull(opts_brkiter)) {
      |        ^~~~~~
      |        Rf_isNull
make: *** [C:/PROGRA~1/R/R-42~1.0/etc/x64/Makeconf:259: stri_brkiter.o] Error 1
ERROR: compilation failed for package 'stringi'
* removing 'D:/Projects/project1/renv/staging/1/stringi'
Error: install of package 'stringi' failed [error code 1]

When I try to load the version directly using devtools it conflicts with renv

require(devtools)
install_version("stringi", version = "1.4.3", repos = "http://cran.us.r-project.org")
require(devtools)
Loading required package: devtools
Loading required package: usethis
Warning messages:
1: package ‘devtools’ was built under R version 4.2.2 
2: package ‘usethis’ was built under R version 4.2.2 
> install_version("stringi", version = "1.4.3", repos = "http://cran.us.r-project.org")
Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/stringi/stringi_1.4.3.tar.gz
Installing package into ‘D:/Projects/project1/renv/library/R-4.2/x86_64-w64-mingw32’
(as ‘lib’ is unspecified)
ℹ Using R 4.2.0 (lockfile was generated with R 4.0.3)
* installing *source* package 'stringi' ...
** package 'stringi' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'D:/Projects/project1/renv/library/R-4.2/x86_64-w64-mingw32/stringi'
* restoring previous 'D:/Projects/project1/renv/library/R-4.2/x86_64-w64-mingw32/stringi'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Projects\project1\renv\library\R-4.2\x86_64-w64-mingw32\00LOCK-stringi\stringi\libs\icudt69l.dat to D:\Projects\project1\renv\library\R-4.2\x86_64-w64-mingw32\stringi\libs\icudt69l.dat: Invalid argument
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying D:\Projects\project1\renv\library\R-4.2\x86_64-w64-mingw32\00LOCK-stringi\stringi\libs\x64\stringi.dll to D:\Projects\project1\renv\library\R-4.2\x86_64-w64-mingw32\stringi\libs\x64\stringi.dll: Permission denied
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/user/AppData/Local/Temp/RtmpK41CGy/remotesce6857a77e39/stringi’ had non-zero exit status
> 
1

There are 1 best solutions below

0
Corey On

The OS/platform by jay.sf made me check over my setup and I realized that I was working with different versions of R. I installed the earlier version, called renv::restore() and the packages successfully installed.