Building R package from github: how to disable building vignettes? - r

I try to build fork of R package from github (this fork has a fresh bugfix). Unfortunatelly, the compilation fails on TeX being missed on my system when trying to build vignettes. I don't want to install loads of SW just to build vignettes I don't need. How can I disable building them?
This is how my compilation went:
> require(devtools)
> install_github("patcpsc/rredis")
Installing github repo rredis/master from patcpsc
Downloading master.zip from https://github.com/patcpsc/rredis/archive/master.zip
Installing package from C:\DOCUME~1\Tomas\LOCALS~1\Temp\Rtmpolel1d/master.zip
Installing rredis
Installing dependencies for rredis:
RUnit
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.freestatistics.org/cran/bin/windows/contrib/3.1/RUnit_0.4.26.zip'
Content type 'application/zip' length 194763 bytes (190 Kb)
opened URL
downloaded 190 Kb
package ‘RUnit’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Documents and Settings\Tomas\Local Settings\Temp\Rtmpolel1d\downloaded_packages
"C:/PROGRA~1/R/R-31~1.0/bin/i386/R" --vanilla CMD build "C:\Documents and Settings\Tomas\Local \
Settings\Temp\Rtmpolel1d\devtools42062762938\rredis-master" --no-manual --no-resave-data
* checking for file 'C:\Documents and Settings\Tomas\Local Settings\Temp\Rtmpolel1d\devtools42062762938\rredis-master/DESCRIPTION' ... OK
* preparing 'rredis':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to build vignettes
* creating vignettes ...Warning: running command '"C:/PROGRA~1/R/R-31~1.0/bin/i386/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 1
ERROR
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
pdflatex is not available
Calls: <Anonymous> -> texi2pdf -> texi2dvi
Execution halted
Error: Command failed (1)
Thanks in advance.

Wow, found it! I missed it as it is not listed in options of install_github function, but it accepts all the other options of install and build functions!
install_github("patcpsc/rredis", build_vignettes = FALSE)

Related

Install R package ERROR installing binary package failed

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 ?

R cannot download websockets package from the github

The manual is written here:https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/R
The mentioned code is written in Section 2 of Install libraries
Problems are with this part
library(devtools)
install_github("brettjbush/R-Websockets")
With R and RTools versions above 4.0 I have following error.
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#HEAD
Installing 1 packages: caTools
Installing package into ‘\\energia.sise/dfs/REDIRECT/german.suhharukov/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/caTools_1.18.0.zip'
Content type 'application/zip' length 317292 bytes (309 KB)
downloaded 309 KB
package ‘caTools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\german.suhharukov\AppData\Local\Temp\RtmpoRYGc0\downloaded_packages
√ checking for file 'C:\Users\german.suhharukov\AppData\Local\Temp\RtmpoRYGc0\remotes1aa03e212c08\brettjbush-R-Websockets-fc7ee9c/DESCRIPTION' (1s)
- preparing 'websockets':
√ checking DESCRIPTION meta-information ...
- cleaning src
Warning in system2(command, args, stdout = NULL, stderr = NULL, ...) :
'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "C:/PROGRA~1/R/R-40~1.3/share/make/clean.mk" -f Makevars.win clean'
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'websockets_1.1.7.tar.gz'
Installing package into ‘\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
'\\sise\dfs\REDIRECT\MYNAME\Documents'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'websockets' ...
** using staged installation
** libs
*** arch - i386
Error in system(cmd) :
(converted from warning) 'CreateProcess' failed to run 'C:\rtools40\usr\bin\make.exe -f "Makevars.win" -f "C:/PROGRA~1/R/R-40~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-40~1.3/share/make/winshlib.mk" SHLIB="websockets.dll" OBJECTS="libsock.o"'
* removing '\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0/websockets'
Error: Failed to install 'websockets' from GitHub:
(converted from warning) installation of package ‘C:/Users/MYNAME/AppData/Local/Temp/RtmpoRYGc0/file1aa0518554ea/websockets_1.1.7.tar.gz’ had non-zero exit status
> install.packages("caTools")
Installing package into ‘\\sise/dfs/REDIRECT/MYNAME/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/caTools_1.18.0.zip'
Content type 'application/zip' length 317292 bytes (309 KB)
downloaded 309 KB
package ‘caTools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\MYNAME\AppData\Local\Temp\XXXXXXX\downloaded_packages
>
Errors are following
> library(devtools)
Loading required package: usethis
> install_github("brettjbush/R-Websockets")
Downloading GitHub repo brettjbush/R-Websockets#master
trying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools35.exe'
Content type 'application/x-msdownload' length 108622512 bytes (103.6 MB)
downloaded 103.6 MB
Error: Failed to install 'websockets' from GitHub:
Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> pkgbuild::check_build_tools(debug = TRUE)
trying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools35.exe'
Content type 'application/x-msdownload' length 108622512 bytes (103.6 MB)
downloaded 103.6 MB
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> find_rtools()
[1] TRUE
> Sys.which("ls.exe")
ls.exe
"C:\\Rtools\\bin\\ls.exe"
How can I download this package?
In the notes on github it says "NOTE: This package is no longer maintained. For implementing websocket servers in R, try the httpuv package"
Another possible problem could be that you are running a new version of R with an old version of Rtools. So I'd try to install the newest version of Rtools or run an older version of R with a compatible version of Rtools, such that you can build and compile the package.
I ran your code on my machine running R 4.0.2 and Rtools 4.0.0 and did not face any issues installing the package. So I'd suggest installinng the newest version of R and Rtools from here: https://cran.r-project.org/bin/windows/Rtools/ and trying again.

Unable to load ggplot2 package

I was trying to install emmeans using install_github and it required that I install rtools and after attempting this I not only was unsuccessful in installing emmeans with the following code:
devtools::install_github("rvlenth/emmeans", dependencies = TRUE, build_opts = "")
Received this:
Error: Failed to install 'emmeans' from GitHub: System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
checking for file 'C:\Users\jmb827\AppData\Local\Temp\RtmpYrGInN\remotes387066d354e0\rvlenth-emmeans-32bf444/DESCRIPTION' ... OK
preparing 'emmeans':
checking DESCRIPTION meta-information ... OK
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 'emmeans_1.4.5.009003.tar.gz'
ERROR
cannot change to directory ''
but now can not load ggplot2 among other packages with error:
package �ggplot2� was built under R version 3.6.3Error: package or namespace load failed for ‘ggplot2’:
package ‘tibble’ does not have a namespace

I can’t download the package BMR from github in R, it gives an error:

> library(devtools)
Download required package: usethis
Warning messages:
1: package ‘devtools' was built under R version 3.5.3
2: package ‘usethis’ was built under R version 3.5.3
> install_github("kthohr/BMR",force=TRUE)
Downloading GitHub repo kthohr/BMR#master
√ checking for file 'C:\Users\Asus\AppData\Local\Temp\RtmpqkzAt0\remotes4b403a3737ba\kthohr-BMR-63565cd/DESCRIPTION' ...
- preparing 'BMR': (3.1s)
√ checking DESCRIPTION meta-information ...
- cleaning src
- checking for LF line-endings in source and make files and shell scripts (1.1s)
- checking for empty or unneeded directories (362ms)
- looking to see if a 'data/datalist' file should be added
- building 'BMR_0.11.0.tar.gz'
Installing package into ‘C:/Users/Asus/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'BMR' ...
** libs
Ошибка: (конвертировано из предупреждения) this package has a non-empty 'configure.win' file,
so building only the main architecture
* removing 'C:/Users/Asus/Documents/R/win-library/3.5/BMR'
In R CMD INSTALL
Error: Failed to install 'BMR' from GitHub:
(converted from warning) installation of package ‘C:/Users/Asus/AppData/Local/Temp/RtmpqkzAt0/file4b4017187131/BMR_0.11.0.tar.gz’ had non-zero exit status
Try this:
install.packages("devtools")
library(devtools)
install_github("kthohr/BMR",force=TRUE)
Please install Rtolls direct its path on R. Then use the following codes.
install.packages("devtools")
library(devtools)
install_github("kthohr/BMR")
library(BMR)
find_rtools()
This to check if rtolls is installed.
If still not working please reinstall R, Rstudio and Rtools then again try running it. It worked in my case.
To check if the package is installed try opening on of the data sets included in the package.
data(BMRMCData)

No vignettes found by browseVignettes where they actually are there

I have a package on a github repository with 2 vignettes in the vignettes/ directory.
I tried to download if with devtools package like this
> if (!require(devtools)) {
+ install.packages("devtools")
+ require(devtools)
+ }
> install_github("MarcinKosinski/RTCGA", build_vignettes=TRUE)
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
"D:/R-32~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"C:/Users/Marcin/AppData/Local/Temp/Rtmpg1Kbfy/devtools3cf47f1f6731/MarcinKosinski-RTCGA-0d91d7c" \
--library="C:/Users/Marcin/Documents/R/win-library/3.2" --install-tests
* installing *source* package 'RTCGA' ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
Reloading installed RTCGA
Welcome to the RTCGA (version: 0.99.6).
but when I try to browse Vignettes it appears they were not build.
> library(RTCGA)
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
I've seen some old issue where people suggested to use build_vignettes=TRUE, but as you see it didn't help OR to add move Vignettes to remove inst/doc/ directory from .Rbuildignore file. But this must be and old issue, because I haven't seen such directory in a binary source after installation of the package.
I've also seen this answer on a similar question, but when I built source and then install package from a source it appears to have the same issue: No vignettes found by browseVignettes("RTCGA").
Any idea on how to make this work?
EDIT
According to Martin's answer
I've addedthis fragment of code to vignettes' YAML
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data - RTCGA Tutorial}
%\VignetteEngine{knitr::rmarkdown}
I've edited YAML of 2 of my vignettes
I've added code to the beggining of YAML - this file
Just in case I once added new information to the end of YAML - this file
but still there appears there are no vignettes available after installation from github
> devtools::install_github("MarcinKosinski/RTCGA")
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/Rtmpk34Zbr/devtools531845716f54/MarcinKosinski-RTCGA-5571117' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' --install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RTCGA)
> library(RTCGA)
Welcome to the RTCGA (version: 0.99.6).
> browseVignettes("RTCGA")
No vignettes found by browseVignettes("RTCGA")
EDIT 2
Of course I've forgoten to add parameter buildVignettes = TRUE but after this it looks like vignettes are seen but there is some problem with their compilation during build:
devtools::install_github("MarcinKosinski/RTCGA", build_vignettes=TRUE)
Downloading github repo MarcinKosinski/RTCGA#master
Installing RTCGA
'/usr/lib/R/bin/R' --vanilla CMD build \
'/tmp/RtmpA7il1Q/devtools5fc871b48f57/MarcinKosinski-RTCGA-e47bdf6' \
--no-resave-data --no-manual
* checking for file ‘/tmp/RtmpA7il1Q/devtools5fc871b48f57/MarcinKosinski-RTCGA-e47bdf6/DESCRIPTION’ ... OK
* preparing ‘RTCGA’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
Removed empty directory ‘RTCGA/ghPage’
Removed empty directory ‘RTCGA/inst’
* building ‘RTCGA_0.99.6.tar.gz’
'/usr/lib/R/bin/R' --vanilla CMD INSTALL \
'/tmp/RtmpA7il1Q/RTCGA_0.99.6.tar.gz' \
--library='/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2' \
--install-tests
* installing *source* package ‘RTCGA’ ...
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
Warning in file(con, "w") :
cannot open file '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA/doc/index.html': No such file or directory
Error in file(con, "w") : cannot open the connection
ERROR: installing vignettes failed
* removing ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
* restoring previous ‘/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.2/RTCGA’
Error: Command failed (1)
From Writing R Extensions, section 1.4.2, your vignettes need to have a line
%\VignetteEngine{knitr::knitr}
in them; a common paradigm is to add the following to the yaml at the top of the vignette
vignette: >
%\VignetteIndexEntry{Integrating TCGA Data}
%\VignetteEngine{knitr::rmarkdown}
VignetteIndexEntry provides a convenient title for R's help system. Remember the BiocStyle package for creating vignettes with a consistent look.
I only could solve this, using:
devtools::build_vignettes()
Of course, then uploading the new files by git

Resources