Install R package ERROR installing binary package failed - r

I'm newbie for R and I built my R package for my users that built without error.
When I install on Windows with devtools::install_local(path = "MyPackage.zip", dependencies = TRUE).
I got error
* installing *binary* package 'MyPackage' ... cp: unknown option -- ) Try '/usr/bin/cp --help' for more information. ERROR: installing binary package failed
After some search I found this thread enter link description here
but I have no Built: in my DESCRIPTION file.
Anyone please can help me how to solve these ?

Related

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

Installing ROracle (and the Oracle Instant Client?) on MacOS

I'm trying to install ROracle. Since ROracle requires the Oracle OCI libraries, I downloaded these files from the Oracle website: instantclient-basic-macos.x64-12.2.0.1.0, instantclient-sdk-macos.x64-12.2.0.1.0.zip. I put those files in ~/Library/Caches/Homebrew and install them using homebrew.
brew install instantclient-basic
brew install instantclient-sdk
The Oracle website also mentioned the need to set some environment variables, so I put this in my .bashrc file:
export LD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$DYLD_LIBRARY_PATH
export NLS_LANG=UTF8
But trying to install ROracle in R leads to this:
> install.packages("ROracle")
Installing package into ‘/usr/local/lib/R/3.4/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.3-1.tar.gz'
Content type 'application/x-gzip' length 308252 bytes (301 KB)
==================================================
downloaded 301 KB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Los_Angeles'
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: OCI libraries not found
ERROR: configuration failed for package ‘ROracle’
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
Warning in install.packages :
installation of package ‘ROracle’ had non-zero exit status
R says it can't find the OCI libraries. Oracle's documentation has so far proven non-existent or worthless in resolving this issue, but I found a comment on the internet that seemed promising. So I wrote this into my .bashrc and ran it:
R CMD INSTALL --configure-args='--with-oci-lib=/usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib --with-oci-inc=/usr/local/Cellar/instantclient-sdk/12.2.0.1.0/lib/sdk/include' ROracle_1.3-1.tar.gz
With this result:
installing to /usr/local/lib/R/3.4/site-library/ROracle/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
****unable to load shared object '/usr/local/lib/R/3.4/site-
library/ROracle/libs/ROracle.so':
dlopen(/usr/local/lib/R/3.4/site-library/ROracle/libs/ROracle.so, 6): Symbol
not found: _ons_recvthread_clone_sb
Referenced from: /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Expected in: flat namespace
in /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
So there's something wrong with libons.dylib? What am I supposed to do with that information?
The Instant Client 12.2 for macOS was patched. Get it from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html and unzip it, for example into ~/instantclient_12_2
I was able to install ROracle on macOS with:
brew install R
Update rpath in the library (using the correct version number for R):
install_name_tool -add_rpath ~/instantclient_12_2 /usr/local/Cellar/r/3.4.3/lib/R/bin/exec/R
Run 'R' and then:
install.packages("DBI")
Download ROracle_1.3-1.tar.gz from https://cran.r-project.org/web/packages/ROracle/index.html and install it:
R CMD INSTALL --configure-args='--with-oci-lib=/Users/cjones/instantclient_12_2 --with-oci-inc=/Users/cjones/instantclient_12_2/sdk/include' ROracle_1.3-1.tar.gz
A solution for that without -add_rpath can be found on Intall ROracle Package for Windows and Mac OS
I use R from Macports and I did:
cd /opt/local/Library/Frameworks/R.framework/Resources/lib
sudo ln -s ~/Applications/instantclient/libclntsh.dylib.12.1
sudo ln -s ~/Applications/instantclient/libclntshcore.dylib.12.1
sudo ln -s libclntsh.dylib.12.1 libclntsh.dylib
sudo ln -s libclntshcore.dylib.12.1 libclntshcore.dylib
I think only the link to libclntsh.dylib.12.1' is needed. But it does not harm to create the others as well. This way you do not need to runinstall_name_tool` after every upgrade to R.
After creating the links I was able to install ROracle using R CMD INSTALL

Rgdal package installation on Amazon Linux AMI

I've installed geos, proj-4.8.0 and gdal-1.9.2, yet, after installing the R package rgeos, rgdal fails to install.
Here is a look at my home directory:
. . . and the error I get running install.packages("rgdal", type="source"):
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal/libs/rgdal.so':
libgdal.so.1: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal’
The downloaded source packages are in
‘/tmp/Rtmpt51iFG/downloaded_packages’
Warning message:
In install.packages("rgdal", type = "source") :
installation of package ‘rgdal’ had non-zero exit status
I infer that this error has something to do with a dependent library. . . but that is all I gather.
I should mention that running sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev as suggested here yields the following:
No package libgdal1 available.
No package libgdal1-dev available.
Package geos-3.4.2-1.3.amzn1.x86_64 already installed and latest version
No package libgeos-dev available.
So, perhaps the better question is how do I install these dev packages?
Thanks for any direction.
You probably need to update the dynamic library cache, using ldconfig as superuser.
Alternatively, rather than building the packages from source, you can enable the Extra Packages for Enterprise Linux (EPEL) repository.

Using old packages that has not been updated on newer version of R

I have updated R and get problems when I want to run old scripts. Specifically, one of the packages I use has been removed from CRAN and I get the following error message when I try to load the installed package (installed from a binary file of the latest version of the package without any problem. As you can see, the package in question is the ACER package):
Failed with error: ‘package ‘acer’ was built before R 3.0.0: please re-install it’
Is it possible to recompile the source file to get binary files that work on R > 3.0.0?? This package worked fine on previous version R 3.0.1, but not on R 3.1.1. Is there any way I can get this package correctly loaded on R 3.1.1 (using either the source file or the file compiled for R 3.0.1?
I already tried to install from source, but it doesn't work. I get this error messages, which don't make too much sense to me. Is there an easy way out of this?
> install.packages(pkgs="acer_0.1.2.tar.gz", type="source", repos=NULL)
Installing package into ‘C:/Users/user/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
* installing *source* package 'acer' ...
** package 'acer' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="acer.dll" OBJECTS="estimate_acer.o peaks.o"' had status 127
ERROR: compilation failed for package 'acer'
* removing 'C:/Users/user/Documents/R/win-library/3.1/acer'
* restoring previous 'C:/Users/user/Documents/R/win-library/3.1/acer'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\user\Documents\R\win-library\3.1" "acer_0.1.2.tar.gz"' had status 1
2: In install.packages(pkgs = "acer_0.1.2.tar.gz", type = "source", :
installation of package ‘acer_0.1.2.tar.gz’ had non-zero exit status
I also tried installing it from the command line but get similar errors. Can anyone help?
Do you have Rcpp installed and on your path?
I think error code 127 on make means that the program couldn't be found in your $PATH and the only dependency of acer seems to be Rcpp.
Hope this helps
-A

Causes of "Error: package '_____' was built before 3.0.0: please re-install it" in R

On one computer running R 2.15.2 I have installed packages from a .zip file (these packages happened to be ggplot2 and data.table, but I don't think the specific package is my issue.) Everything works fine. I took these packages to a computer without an internet connection and installed them. This other computer is running R 3.0.1. The packages seemed to install without a problem (using R's "install package(s) from local zip file" option). When I call the packages with the library(), I get the following error:
Error: package '<insert name of newly installed package here>' was build before 3.0.0: please-re-install it
Can anyone explain potential causes for this error to be thrown? Are there particular directories that the .zip packages must be in for a proper install? If R is installed on a separate partition from where the .zip packages were loaded, could this cause the error?
I'm at a loss, any pointers are greatly appreciated. This is a difficult one to reproduce; if you need any other version/system parameters to understand the problem, please don't hesitate to ask.
I found this solution while look at GitHub ggplot2 issue #796
update.packages(checkBuilt = TRUE, ask = FALSE)
It will update all the packages that need to be reinstalled.
Running install.packages("codetools") can fix this issue for R 3.0.2, if you have the same problem like me:
installing to /home/user/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/libs
** R
** inst
** preparing package for lazy loading
Error : package ‘**codetools**’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’
I installed shiny according https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions
and got the same error at the step
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
Warning messages:
1: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘httpuv’ had non-zero exit status
3: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘shiny’ had non-zero exit status
I tried the answer by Richard Lee by starting R
R
and got the error
Warning in install.packages("shiny") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (y/n) n
Error in install.packages("shiny") : unable to install packages
obviously no write permission, so
sudo R
Now I tried again
install.packages("shiny")
and got a number of errors
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : package ‘RJSONIO’ was built before R 3.0.0: please re-install it
Error : package ‘caTools’ was built before R 3.0.0: please re-install it
Error : package ‘bitops’ was built before R 3.0.0: please re-install it
Error : package ‘digest’ was built before R 3.0.0: please re-install it
Error : package ‘xtable’ was built before R 3.0.0: please re-install it
Each time I got an error, I re-installed the requested package
install.packages("codetools")
install.packages("RJSONIO")
etc.
and eventually, I was able to install Rccp, httpuv, and even shiny.
Now it works!!
Also see
Shiny package installation on R version 3.0.2 "Frisbee Sailing"
I am using rkward on precise
I had a similar error using rkward. Specifically this one:
'lib = "/usr/local/lib/R/site-library"' is not writable
I temporarily changed the permissions for this directory so that rkward could run this from its console:
update.packages(checkBuilt = TRUE, ask = FALSE)
all to fix this:
Error: package '' was build before 3.0.0: please-re-install it
so that (sigh...) I could fix 'default' configuration for audio on precise. I couldn't use play() etc. in rkward.
That just needed phonon-backend-gtstreamer
I tried to install swirl on R(v3.1.0) on ubuntu 12.04LTS:
sudo R
install.packages("swirl")
But faced a similar error:
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘httr’
ERROR: lazy loading failed for package ‘httr’
* removing ‘/usr/local/lib/R/site-library/httr’
ERROR: dependencies ‘testthat’, ‘httr’ are not available for package ‘swirl’
* removing ‘/usr/local/lib/R/site-library/swirl’
Doing following helped me:
install.packages('codetools')
install.packages("swirl")
library("swirl")
swirl()
| Welcome to swirl! Please sign in. If you've been here before, use the same
| name as you did then. If you are new, call yourself something unique.
What shall I call you?
I hope the same may help fix your installation issue.
Here is the work-around that I used:
I installed the latest version of R on an internet-capable computer. I then loaded the my required packages (Packages->install packages->select mirror->select package...
After R is finished installing, it displays a message of where the temporary .zip package is located. I navigated to this location, grabbed the temp package, and burnt it to a cd.
In this way, I could get the newer package build onto a computer without internet access. I would still be interested to know if there is an easy way to rebuild a package downloaded on an early R version to make it compatible with the latest version (without needed an internet connection).
Thanks for pointing me in the right direction #JoshuaUlrich

Resources