I am trying to install the package stringi with renv::install().
Normally, I would use
install.packages('stringi', configure.vars='ICUDT_DIR=path/to/icudt61l.zip/')
To specify the location of icudt61l.zip dependency.
How can I do this in renv ?
I tried to add ICUDT_DIR='path/to/icudt61l.zip/' in my .Rprofile but it didn't work.
Any idea how to tell renv where is ICU to install stringi ?
Here is the error I get
> renv::install("stringi")
...
Installing stringi [1.6.2] ...
FAILED
Error installing package 'stringi':
===================================
...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /opt/R/4.0.3/lib/R
checking for R... /opt/R/4.0.3/lib/R/bin/R
...
checking with pkg-config for the system ICU4C... 50.1.2
checking for ICU4C >= 55... no
*** ICU4C 50.1.2 has been detected
*** Minimal requirements, i.e., ICU4C >= 55, are not met
*** Trying with 'standard' fallback flags
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... no
*** This version of ICU4C cannot be used.
*** Using the ICU 69 bundle.
checking whether we may compile src/icu69/common/putil.cpp... yes
checking whether we may compile src/icu69/i18n/number_affixutils.cpp... yes
checking whether alignof(std::max_align_t) is available... no
checking whether alignof(::max_align_t) is available... yes
checking whether the ICU data library can be downloaded... downloading the ICU data library (icudt)
output path: icu69/data/icu4c-69_1-data-bin-l.zip
trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
icudt download failed
Error: Stopping on error
In addition: Warning messages:
1: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
2: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
Execution halted
*** *********************************************************************
*** stringi cannot be built.
*** Failed to download the ICU data library (icudt). Stopping now.
*** For build environments that have no internet access,
*** see the INSTALL file for a workaround.
*** *********************************************************************
ERROR: configuration failed for package ‘stringi’
* removing ‘/var/projects/iml/GDCFA21N/avertie_test/renv/staging/2/stringi’
Error: install of package 'stringi' failed [error code 1]
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
just use this command, can be load ICUDT from local.
if you run this all have ERROR,in icudt cannot connect.You should follow this https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL.
follow like this:
ICU Data Library and No Internet Access
Note that if you choose to use our ICU4C bundle, then -- by default -- the
ICU data library will be downloaded from one of our mirror servers.
However, if you have already downloaded a version of icudt*.zip suitable
for your platform (big/little endian), you may wish to install the
package by calling:
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
Moreover, if you have no internet access on the machines
you try to install stringi on, try fetching the latest development version
of the package, as it is shipped with the ICU data archives.
You can build a distributable source package that includes all the required
ICU data files (for off-line use) by omitting some relevant lines in
the .Rbuildignore file. The following command sequence should do the trick:
wget https://github.com/gagolews/stringi/archive/master.zip -O stringi.zip
unzip stringi.zip
sed -i '/\/icu..\/data/d' stringi-master/.Rbuildignore
R CMD build stringi-master
Assuming the most recent development version of the package is numbered x.y.z,
a file named stringi_x.y.z.tar.gz is created in the current working directory.
The package can now be installed (the source bundle may be propagated via
scp etc.) by executing:
R CMD INSTALL stringi_x.y.z.tar.gz
Alternatively, call from within an R session:
install.packages("stringi_x.y.z.tar.gz", repos=NULL)
From ?renv::install:
Package Configuration:
Many R packages have a 'configure' script that needs to be run to
prepare the package for installation. Arguments and environment
variables can be passed through to those scripts in a manner
similar to install.packages. In particular, the R options
'configure.args' and 'configure.vars' can be used to map package
names to their appropriate configuration. For example:
# installation of RNetCDF may require us to set include paths for netcdf
configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2"))
options(configure.args = configure.args)
renv::install("RNetCDF")
Similarly, additional flags that should be passed to R CMD INSTALL
can be set via the 'install.opts' R option:
# installation of R packages using the Windows Subsystem for Linux
# may require the `--no-lock` flag to be set during install
options(install.opts = "--no-lock")
renv::install("xml2")
Setting something like:
options(configure.vars = list(stringi = "ICUDT_DIR=path/to/icudt61l.zip"))
should hopefully get you unstuck.
Related
In R (and when installing ROracle package), how do I set OCI_LIB64? I've downloaded Oracle Instant Client and have pointed the wd and the OCI_LIB64 to that. I have Windows 10 Enterprise. It's RStudio version 1.1.463 and R version 3.4.3.
I tried the following:
setwd('C:\\Users\\sriley03\\Documents\\') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
install.packages('ROracle_1.3-1.tar.gz', repos = NULL)
but I get the following output and errors:
> setwd('C:\\Users\\sriley03\\Documents\\') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/ inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.Error: unexpected symbol in "set OCI_LIB64"
> setwd('C:\\Users\\sriley03\\Documents\\instantclient_19_3') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/instantclient_19_3 inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.> set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
Error: unexpected symbol in "set OCI_LIB64"
> install.packages('ROracle_1.3-1.tar.gz', repos = NULL)
Warning: invalid package 'ROracle_1.3-1.tar.gz'
Error: ERROR: no packages specified
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" "ROracle_1.3-1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘ROracle_1.3-1.tar.gz’ had non-zero exit status
What can I do so that I can set OCI_LIB64 properly so that I can install ROracle?
Thanks!
UPDATE (8_28_19):
I've set the OCI_LIB64 and the OCI_INC to the correct paths
Sys.setenv(OCI_LIB64="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")
Sys.setenv(OCI_INC="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")
But now I get the following response (even though all the required headers are in that file):
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
Oracle Client Shared Library 64-bit - 19.3.0.0.0 Operating in Instant Client mode.
found Oracle Client C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
found Oracle Client include C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
ERROR: cannot find Oracle Client include headers in C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3.
Please set OCI_INC to correct location.
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Program Files/R/R-3.4.3/library/ROracle'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" C:\Users\sriley03\AppData\Local\Temp\RtmpWUfabz/downloaded_packages/ROracle_1.3-1.tar.gz' had status 1
Try to download the SDK Package from Oracle and unzip it in your instant client folder.
set the environment variable OCI_INC to the 'include' folder located in your instant client folder: ..."instantclient_xx_x\sdk\include"
Then, reinstall the packages.
If you still get a failure error, try to copy all files from sdk\include folder to your R include folder, then try again
Complete newbie here, so there is probably something glaringly bad here. I created a Project following Hadley Wickham's book on R packages, and now I am trying add it to github for remote install (repository for reference).
Running devtools::install_github("alutterb/abcmlr") generated the following output:
Downloading GitHub repo alutterb/abcmlr#master
√ checking for file 'C:\Users\amlut\AppData\Local\Temp\RtmpMpn5uJ\remotes7146c405dd7\alutterb-abcmlr-918bf05/DESCRIPTION' ...
- preparing 'abcmlr':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'abcmlr_0.1.0.tar.gz'
Installing package into ‘C:/Users/amlut/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *binary* package 'abcmlr' ...
cp: unknown option -- )
Try '/Rtools/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/Users/amlut/Documents/R/win-library/3.5/abcmlr'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/amlut/AppData/Local/Temp/RtmpMpn5uJ/file71463953e7b/abcmlr_0.1.0.tar.gz’ had non-zero exit status
In my repository, I have a Linux executable that is to be used with wsl as well as an .exe file that is called in my R code. These may be the culprits, but I am not entirely sure. The error states that it failed to install the binary package, but install_github() takes a source package, so I am not sure what is going on. Any help is appreciated.
Thank you.
EDIT: This problem is solved. It was because of a line in my DESCRIPTION file that had to do with Built.
Check your %PATH% and type: where cp.
Another cp (like one from the Git for Windows distribution) might overshadow the RTools cp, which might explain the error message.
As commented by the OP hkj447, the error was trigger by a line in the DESCRIPTION file:
Built: R 3.5.3; ; 2019-06-14 21:17:43 UTC; windows
As seen in this thread:
You have a field called 'Built:' in your package's DESCRIPTION file;
R normally tries to inject that field itself when it builds your package from sources.
I deleted "Built"'s line in DESCRIPTION and then installed again.
This time, no error appeared.
I'm running Mac OS X 10.7.5 (Lion), which means that the latest version of R I can run is 3.2.1. Since binaries of packages are no longer being made for this version, it means that I need to install the latest package versions from source. I can do this with
install.packages(pkgs, type = "source")
I installed GNU Fortran, although it's not clear to me whether I need it or not in order to compile R packages.
When I try to compile packages from source in R, however, I get error messages indicating that I don't have (or that R cannot find) the necessary compiling tools. Cf. e.g.:
* installing *source* package ‘scales’ ...
** package ‘scales’ successfully unpacked and MD5 sums checked
** libs
sh: make: command not found
ERROR: compilation failed for package ‘scales’
and
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... yes
checking for cat... /bin/cat
/Library/Frameworks/R.framework/Resources/bin/config: line 150: make: command not found
[...]
checking for gcc... no
checking for cc... no
checking for cl.exe... no
/Library/Frameworks/R.framework/Resources/bin/config: line 153: make: command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 269: make: command not found
configure: error: in `/private/var/folders/2r/6c5vhb4s3zx3zs4d1dbf9p940000gn/T/Rtmpob4pMm/R.INSTALLd4676ad8595/stringi':
configure: error: no acceptable C compiler found in $PATH
I assume what's needed is to install the necessary compiling tools for R packages. What do I need to do?
(If I need to provide additional information, just ask for it in a comment, and I will provide it)
It might be tricky. First of all, double check whether you can download XCode from AppStore or not. If you can, you will be able to install command line tools as well. Either via Preferences -> Downloads (as far as I recall), or they will be installed during first startup.
Alternatively, create free account here:
http://developer.apple.com
Then, head to:
https://developer.apple.com/download/more/
and find XCode. It might be you will need to install some really old version.
As #hrbrmstr mentioned, it might be that installing virtual machine (e.g. inside VirtualBox) with Linux will be less painful.
Note that you will probably encounter more and more issues while installing packages. There is no easy way if you are forced to stick with old OS X :(
Update:
As #Sverre pointed out, it would be better to have a complete list of links here:
XCode - (Lion version) download from Apple (not to confuse with AppStore)
Command Line Tools - (Lion version) you can install them separately, without installing XCode
I've been writing a lot of code for my personal use and finally reached a point where I realised I should really be including this all in a package which I can load in instead of copy and pasting it in each time.
I followed the following tutorial for the creation of a basic package.
https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/
As far as I can tell everything went well with the actual creation element. Here are screenshots of the result:
The cats folder:
The /cats/R folder
The /cats/man folder
The problem comes when I want to run the line:
install("cats")
When I try to do that I get the following error:
Installing cats
"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL "/Documents/cats" --library="C:/Users/Aodhán/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'cats' ...
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
* removing 'C:/Users/Aodhán/Documents/R/win-library/3.3/cats'
Error: Command failed (1)
This error happens for my own package, but it also happens if I run the command:
devtools::install_github("klutometis/roxygen")
Any advice would be appreciated.
EDIT: Could it be that my username contains the character á in it?
EDIT 2:The DESCRIPTION file is:
Package: cats
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors#R: person("First", "Last", email = "first.last#example.com",
role = c("aut", "cre"))
Maintainer: Aodhán O'Leary
Author: Aodhán O'Leary [aut, cre]
Description: What the package does (one paragraph).
Depends: R (>= 3.3.1)
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
Sys.getenv("R_HOME") returns "C:/PROGRA~1/R/R-33~1.1"
Sys.getenv("R_LIBS_USER") returns "C:\Users\Aodhán\Documents/R/win-library/3.3"
Sys.getenv("R_HOME") returns "C:\Users\Aodhán\Documents"
devtools::build("cats") creates "cats_0.0.0.9000.tar.gz"
install.packages("../cats_version.tar.gz") returns the same error as above
Note: This is on a Win10 machine, using R 3.3.1, which I apologise for not mentioning up top. I was quite tired when writing the post yesterday.
Edit 3: Here's the result of using the following commands: R CMD build cats followed by R CMD check cats
00check:
using log directory 'C:/Users/Aodhán/Documents/cats.Rcheck'
using R version 3.3.1 (2016-06-21)
using platform: x86_64-w64-mingw32 (64-bit)
using session charset: ISO8859-1
checking for file 'cats/DESCRIPTION' ... OK
this is package 'cats' version '0.0.0.9000'
package encoding: UTF-8
checking package namespace information ... OK
checking package dependencies ... OK
checking if this is a source package ... OK
checking if there is a namespace ... OK
checking for .dll and .exe files ... OK
checking for hidden files and directories ... NOTE Found the following hidden files and directories: .gitignore These were most
likely included in error. See section 'Package structure' in the
'Writing R Extensions' manual.
checking for portable file names ... OK
checking whether package 'cats' can be installed ... ERROR Installation failed. See
'C:/Users/Aodhán/Documents/cats.Rcheck/00install.out' for details.
DONE
Status: 1 ERROR, 1 NOTE
00install.out
installing source package 'cats' ...
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/Aodhan/Documents/cats.Rcheck/cats/DESCRIPTION':
No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'cats'
removing 'C:/Users/Aodhán/Documents/cats.Rcheck/cats'
The problem was the special character in my name, á. When I put it in the C:\ directory and ran R CMD build cats and R CMD check cats it passed that error (though there was an error later on with the pdf - I'll see if I can resolve that myself).
I'll try and post this as a bug. Moderately annoying. Should have thought of that test earlier.
I've run into this problem recently (R version 3.5.2) on two different computers. I don't have the full, exact error message right now, but it contained the following two snippets:
Error in writeLines(paste0(c(out[is_not_empty]), eor), file, useBytes = useBytes) :
(converted from warning) invalid char string in output conversion
and
ERROR: installing package DESCRIPTION failed for package
The problem, I believe, was the existence of special characters in my .Rprofile file. I'd been meaning to get rid of that file anyway (for the sake of reproducibility), and doing so fixed the problem.
To do this in R, the code below will (1) copy your .Rprofile and save it as .Rprofile-old (in case you want to use/restore it later on) and then (2) delete your .Rprofile.
## copy backup of .Rprofile
file.copy("~/.Rprofile", "~/.Rprofile-old")
## delete .Rprofile
unlink("~/.Rprofile")
Once you've run the above code, restart R and the problem will [hopefully] be fixed!
Installing source package..
It is important to specify repo and type
Convert package into package_name.tar.gz
Get into project environment by double clicking the .Rproj file in
your project and click on build -> Build Source Package to build tar.gz file
install.packages("full_path/package_name.tar.gz", repo = NULL, type =
"source")
I'm trying to install development version of ggbiplotfrom Github. During installation I'm getting the following error message:
library(devtools)
install_github("ggbiplot", "vqv")
Installing github repo(s) ggbiplot/master from vqv
Installing ggbiplot.zip from https://github.com/vqv/ggbiplot/zipball
Installing ggbiplot
* checking for file 'C:\Users\Muhammad Yaseen\AppData\Local\Temp\Rtmpsx4n5u\vqv-ggbiplot-2623d7c/DESCRIPTION' ... OK
* preparing 'ggbiplot':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'ggbiplot_0.5.tar.gz'
cygwin warning:
MS-DOS style path detected: C:/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
Preferred POSIX equivalent is: /cygdrive/c/Users/MUHAMM~1/AppData/Local/Temp/Rtmpsx4n5u/ggbiplot_0.5.tar.gz
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Warning: invalid package 'Yaseen/R/win-library/2.14'
Error: ERROR: cannot cd to directory 'C:/Users/Muhammad'
Error: Command failed (1)
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz --library=C:/Users/Muhammad Yaseen/R/win-library/2.14' had status 1
Any idea to figure out this problem. Thanks in advance for your help and time.
Edit
After downloading from Github, also tried
install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos=NULL, type="source")
which produced this error message
Installing package(s) into ‘C:/Users/Muhammad Yaseen/R/win-library/2.14’
(as ‘lib’ is unspecified)
Error in untar2(tarfile, files, list, exdir) : unsupported entry type 'g'
Warning messages:
1: running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL -l "C:/Users/Muhammad Yaseen/R/win-library/2.14" "vqv-ggbiplot-2623d7c.tar.gz"' had status 1
2: In install.packages("vqv-ggbiplot-2623d7c.tar.gz", repos = NULL, :
installation of package ‘vqv-ggbiplot-2623d7c.tar.gz’ had non-zero exit status
It's because your Rlib path has a space in it: C:/Users/Muhammad Yasseen/R/win-library/2.14.
See how in the first error log the warning message was
running command '"C:/PROGRA~1/R/R-214~1.2/bin/i386/R" CMD INSTALL
C:\Users\MUHAMM~1\AppData\Local\Temp\Rtmpsx4n5u/ggbiplot_0.5.tar.gz
--library=C:/Users/Muhammad Yaseen/R/win-library/2.14'
had status 1
In particular, the --library=C:/Users/Muhammad Yaseen/R/win-library/2.14.
This should be --library="C:/Users/Muhammad Yaseen/R/win-library/2.14" to deal with the space.
Using install.packages takes care of the quotes for you - see how your second warning message (when you used install.packages) was
running command 'C:/PROGRA~1/R/R-214~1.2/bin/i386/R CMD INSTALL
-l "C:/Users/Muhammad Yaseen/R/win-library/2.14"
"vqv-ggbiplot-2623d7c.tar.gz"' had status 1
The -l "C:/Users/Muhammad Yasseen/R/win-library/2.14" has quote marks around it, so you don't get the same error.
I had a quick look at the install-github sources, and it constructs the R CMD INSTALL command via:
paste("CMD INSTALL ", built_path, " --library=", .libPaths()[1], sep="")
See how it doesn't surround .libPaths()[1] by double quotes in case of spaces? I'd guess that's your problem.
As to a fix - there seems to be an error using install.packages() on a tar file generated by git (as reported here). So, you can either:
change your R library location to somewhere without spaces
unzip the .tar.gz file (I don't know what software does this on Windows) and install from the extracted directories rather than the .tar.gz.
You can't unzip the .tar.gz because it cleans up that file quicker than you can grab it (I've watched it appear and get deleted again). Correct me if I'm wrong, but I also can't get devtools from github for teh same reason :S