R install.package fails on data-raw file not found - r

I am building an R package, with some associated data. I have created a data-raw folder using usethis:: functions, put various txt fies there, and built out R code to generate the .rda/Rdata files. I have used the use_data() function to generate the .rda and Rdata files and these I can see in /data.
I can retrieve these objects using load_all().
I then build a source package, which generates a compressed-tar-ball.
Finally I attempt to install that tar-ball/package in another project and get:
devtools::install_local("/home/fred/Rprojects/evidently/evidently_0.0.2.1.tar.gz")
✓ checking for file ‘/tmp/Rtmp53yb8S/remotes2eaf7a4fc2cb/evidently/DESCRIPTION’ ...
─ preparing ‘evidently’:
✓ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘evidently_0.0.2.1.tar.gz’
Installing package into ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘evidently’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error : **'/tmp/Rtmp0PbObQ/R.INSTALL391126f5cc7c/evidently/data-raw/TPBULET-A.txt' does not exist.**
Error: unable to load R code in package ‘evidently’
Execution halted
ERROR: lazy loading failed for package ‘evidently’
* removing ‘/home/fred/R/x86_64-pc-linux-gnu-library/4.0/evidently’
* restoring previous ‘/home/rob/R/x86_64-pc-linux-gnu-library/4.0/evidently’
Error: Failed to install 'evidently' from local:
(converted from warning) installation of package ‘/tmp/Rtmp53yb8S/file2eaf5f6ca68c/evidently_0.0.2.1.tar.gz’ had non-zero exit status
>
But the file it says it is looking for is in data-raw in the package folder.
I am missing something obvious here. I would welcome suggestions on why the system is not seeing the txt file, and why it is therefore aborting the install.

This happens when you have a rogue link to the data-raw file, in a file you thought you had purged, and when it gets loaded as part of install-packages, it tries to find a file in data-raw/ that is not there in the package, because data-raw/ is not part of the package, just in the source code. So, search your files and find the forgotten bit of code. Hang head in shame.

Related

Cannot mannually install package in R

I am trying to install package using:
library(devtools)
install_github("s-conner/rmtl/rpackage")
However, I got error:
Error: Failed to install 'RMTL' from GitHub:
schannel: failed to receive handshake, SSL/TLS connection failed
Any advise, please?
It installs fine for me (on Linux). As the output shows, I also have a GITHUB_PAT but I do not think that should be required for a public repository.
$ installGithub.r s-conner/rmtl/rpackage
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo s-conner/rmtl#HEAD
── R CMD build ────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/remotes16a2746ead7197/s-conner-rmtl-c2fb188/rpackage/DESCRIPTION’ ...
─ preparing ‘rmtl’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Omitted ‘LazyData’ from DESCRIPTION
─ building ‘rmtl_0.0.0.9000.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘rmtl’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rmtl)
$
(where installGithub.r is a simple convenience wrapper for remotes::install_github from my littler CRAN package.)
So I guess you need to work out why the https handshake to GitHub fails for you. It would seem that GitHub serves the repository just fine.
you can also source the 3 functions in the package at the start of your code
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/cif.R")
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/rmtl.R")
devtools::source_url("https://raw.githubusercontent.com/s-conner/rmtl/master/rpackage/R/rmtl_mod.R")
You can also download the 3 r scripts files and source them
source("path/to/rmtl.R")

Error 404 installing R package from public github repro

I am trying to install the gaRdenbox package from github (https://github.com/KTMD-plant/gaRdenbox)
But when I run
install_github("KTMD-plant/gaRdenbox")
it returns
Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
Not Found
Did you spell the repo owner (KTMD-plant) and repo name (gaRdenbox) correctly?
-If spelling is correct, check that you have the required permissions to access the repo.
As far as I can see the repro is public. Do you have any idea what is the issue here?
This is a bug in package gaRdenbox as the file DESCRIPTION is 'missing' given that there is only a file Description.
You can test that by forking the package and altering the file by renaming it -- which I did in this fork in my repo. Now we can install as expected:
edd#rob:/tmp$ installGithub.r eddelbuettel/gaRdenbox
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo eddelbuettel/gaRdenbox#HEAD
✔ checking for file ‘/tmp/remotes12841a2d0cc36c/eddelbuettel-gaRdenbox-fd41a57/DESCRIPTION’ ...
─ preparing ‘gaRdenbox’:
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘gaRdenbox_0.0.1.0.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘gaRdenbox’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (gaRdenbox)
edd#rob:/tmp$
(where installGitHub.r is a simple wrapper for the command-line from my littler package). You can ignore the PAT message; I have one in my environment for other reasons.
I have filed a PR at the upstream repo.

How do I get around the error in R package building

I built a R package using the build command shown below but now I can't build another with it. Please inform me on what is causing the error. The code is as follows:
C:\Users\abu\Documents> R CMD build analysiscb
The system cannot find the path specified.
checking for file 'analysiscb/DESCRIPTION' ... OK
preparing 'analysiscb':
checking DESCRIPTION meta-information ... OK
installing the package to process help pages
-----------------------------------
The system cannot find the path specified.
installing source package 'analysiscb' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'analysiscb'
finding HTML links ... done
analysiscb-package html
bcr.decide html
npv.eval html
rbcr html
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
DONE (analysiscb)
-----------------------------------
ERROR: package installation failed
C:\Users\abu\Documents>
Somehow I renamed the functions, rerun the package skeleton and accessed the cmd as the administrator. Touché! It was successful.

R ggbiplot installation errer

I know this is a recurrent issue. However, going through all the hits when I google still has not helped me solve the issue. I hope someone can help: Her is what I do:
1: I run
install.packages('devtools')
library(devtools)
This appears to run all right. At least I do not get any error messages.
2: then I do:
install_github('vqv/ggbiplot', force=TRUE)
Then the errors messages comes:
install_github('vqv/ggbiplot', force=TRUE)
Downloading GitHub repo vqv/ggbiplot#master
√ checking for file 'C:\Users\jada\AppData\Local\Temp\RtmpgvAEpK\remotes28461c455b1\vqv-ggbiplot-7325e88/DESCRIPTION' ...
- preparing 'ggbiplot':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'ggbiplot_0.55.tar.gz'
Installing package into ‘C:/Users/jada/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing source package 'ggbiplot' ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'ggplot2' was built under R version 3.6.1
Execution halted
ERROR: lazy loading failed for package 'ggbiplot'
* removing 'C:/Users/jada/Documents/R/win-library/3.6/ggbiplot'
Error: Failed to install 'ggbiplot' from GitHub:
(converted from warning) installation of package ‘C:/Users/jada/AppData/Local/Temp/RtmpgvAEpK/file28421d56f74/ggbiplot_0.55.tar.gz’ had non-zero exit status
If anyone could sort me out here, I would be very happy.
Thank you.
jd
I suggest you to go in the path of the library in your computer (should be c:/Users/jada/Documents/R/win-library/3.6/) and delete the ggbiplot folder. After this, redo the installation process.
In this way you remove every possible problem conflict.
If this doesn't work out try also to delete ggbiplot_0.55.tar.gz in the Temp folder as suggested in the error.
I know it is an old question, but I have found a solution in here, and just in case the link does not work, here is the possible solution:
install.packages("remotes")
remotes::install_github("vqv/ggbiplot")

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.

Resources