Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails when creating vignettes #2407

Closed
FelicienLL opened this issue Jan 27, 2022 · 14 comments
Closed

Build fails when creating vignettes #2407

FelicienLL opened this issue Jan 27, 2022 · 14 comments

Comments

@FelicienLL
Copy link

Hello,
devtools::build() and devtools::check() fail if the package contains vignettes. Probably not related to the vignette itself though, because I can generate it with a manual knittering or with devtools::build_vignettes().
Looks like it has something to do with the temporary file where the package is installed.

> devtools::build()
√  checking for file 'C:\Users\le_louedec\Documents\PACKAGE\bla/DESCRIPTION'
-  preparing 'bla':
√  checking DESCRIPTION meta-information ... 
-  installing the package to build vignettes
E  creating vignettes (1.5s)
   Error: file 'C:/Users/le_louedec/AppData/Local/Temp/RtmpELz9qr/Rbuild38f033f814dd/bla/DESCRIPTION' is not in valid DCF format
  In addition: Warning message:
  In read.dcf(dfile, keep.white = .keep_white_description_fields) :
     cannot open compressed file 'C:/Users/le_louedec/AppData/Local/Temp/RtmpELz9qr/Rbuild38f033f814dd/bla/DESCRIPTION', probable reason 'Permission denied'
   Execution halted
Error in (function (command = NULL, args = character(), error_on_status = TRUE,  : 
  System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
Type .Last.error.trace to see where the error occurred

It is not due to the format of the DESCRIPTION file I think, because I use the one generated by usethis::use_description, and the check/build is ok when there are no vignettes. Also, I do not understand why it is said that permission is denied since there are no administrator rights for the folder, and it seems like it can be written:

file.access("C:/Users/le_louedec/AppData/Local/Temp/", mode = 2)
#> C:/Users/le_louedec/AppData/Local/Temp/ 
#>                                       0

Do you have any idea of where I could keep on my investigation ?

Many thanks in advance

Félicien

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.7.1    devtools_2.4.3 usethis_2.1.5 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8        jquerylib_0.1.4   bslib_0.3.1       compiler_4.1.2    later_1.3.0       prettyunits_1.1.1 remotes_2.4.2     tools_4.1.2      
 [9] testthat_3.1.2    digest_0.6.29     pkgbuild_1.3.1    pkgload_1.2.4     jsonlite_1.7.3    memoise_2.0.1     lifecycle_1.0.1   rlang_1.0.0      
[17] reprex_2.0.1      cli_3.1.1         rstudioapi_0.13   yaml_2.2.2        fastmap_1.1.0     withr_2.4.3       sass_0.4.0        desc_1.4.0       
[25] fs_1.5.2          rprojroot_2.0.2   glue_1.6.1        R6_2.5.1          processx_3.5.2    sessioninfo_1.2.2 clipr_0.7.1       callr_3.7.0      
[33] purrr_0.3.4       magrittr_2.0.2    ps_1.6.0          promises_1.2.0.1  ellipsis_0.3.2    htmltools_0.5.2   mime_0.12         xtable_1.8-4     
[41] httpuv_1.6.5      miniUI_0.1.1.1    cachem_1.0.6      crayon_1.4.2      brio_1.1.3       
@jennybc
Copy link
Member

jennybc commented Feb 22, 2022

Is the source of the affected package available on GitHub so I could see if I can replicate this on Windows?

@FelicienLL
Copy link
Author

I'm afraid it is whatever the package. Even with a simple package just created with devtools::create() and usethis::use_vignette(), for instance https://github.com/FelicienLL/hello .
Sorry not to be able to provide a more explicit reproducible example.

@jennybc
Copy link
Member

jennybc commented Feb 22, 2022

I can devtools::build() and devtools:check() the source package I download from https://github.com/FelicienLL/hello, on Windows.

So I'm afraid that suggests it something odd about your machine / setup. It still could be an infelicity in devtools, but that makes it kind of tricky and (sorry) low priority for attention. If you can dig in more, that might be your best hope.

> Sys.info()[["sysname"]]
[1] "Windows"


> devtools::build()
√  checking for file 'C:\Users\jenny\Desktop\hello/DESCRIPTION' (389ms)
-  preparing 'hello':
√  checking DESCRIPTION meta-information ... 
-  installing the package to build vignettes
√  creating vignettes (6s)
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'hello_0.0.0.9000.tar.gz'
   
[1] "C:/Users/jenny/Desktop/hello_0.0.0.9000.tar.gz"



> devtools::check()
i Updating hello documentation
i Loading hello
-- Building -------------------------------------------------- hello --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
* CXX14FLAGS: -Wall -pedantic
* CXX17FLAGS: -Wall -pedantic
* CXX20FLAGS: -Wall -pedantic
-----------------------------------------------------------------------
√  checking for file 'C:\Users\jenny\Desktop\hello/DESCRIPTION' (587ms)
-  preparing 'hello':
√  checking DESCRIPTION meta-information ...
-  installing the package to build vignettes
√  creating vignettes (3.3s)
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'hello/man'
-  building 'hello_0.0.0.9000.tar.gz'
   
-- Checking -------------------------------------------------- hello --
Setting env vars:
* _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE
* _R_CHECK_CRAN_INCOMING_       : FALSE
* _R_CHECK_FORCE_SUGGESTS_      : FALSE
* NOT_CRAN                      : true
-- R CMD check --------------------------------------------------------
-  using log directory 'C:/Users/jenny/AppData/Local/Temp/Rtmp6D4z1j/hello.Rcheck' (447ms)
-  using R version 4.1.2 (2021-11-01)
-  using platform: x86_64-w64-mingw32 (64-bit)
-  using session charset: ISO8859-1
-  using options '--no-manual --as-cran'
√  checking for file 'hello/DESCRIPTION' ... 
-  this is package 'hello' version '0.0.0.9000'
-  package encoding: UTF-8
√  checking package namespace information
√  checking package dependencies (2.8s)
√  checking if this is a source package ...
√  checking if there is a namespace
√  checking for executable files (373ms)
√  checking for hidden files and directories ... 
√  checking for portable file names
√  checking serialization versions
√  checking whether package 'hello' can be installed (3.5s)
√  checking installed package size ... 
√  checking package directory ... 
√  checking for future file timestamps ... 
√  checking 'build' directory
W  checking DESCRIPTION meta-information (687ms)NING
   Non-standard license specification:
     `use_mit_license()`, `use_gpl3_license()` or friends to pick a
     license
   Standardizable: FALSE
√  checking top-level files
√  checking for left-over files
√  checking index information (375ms)
√  checking package subdirectories (389ms)
√  checking whether the package can be loaded (365ms)
√  checking whether the package can be loaded with stated dependencies ... 
√  checking whether the package can be unloaded cleanly ... OK
√  checking whether the namespace can be loaded with stated dependencies ... 
√  checking whether the namespace can be unloaded cleanly (380ms)
√  checking loading without being on the library search path (439ms)
    WARNING
   'qpdf' is needed for checks on size reduction of PDFs
√  checking installed files from 'inst/doc'
√  checking files in 'vignettes' ... 
-  checking examples ... NONE (351ms)
√  checking for unstated dependencies in vignettes (363ms)
√  checking package vignettes in 'inst/doc' ...
√  checking re-building of vignette outputs (1.7s)
√  checking for non-standard things in the check directory
√  checking for detritus in the temp directory
   
   See
     'C:/Users/jenny/AppData/Local/Temp/Rtmp6D4z1j/hello.Rcheck/00check.log'
   for details.
   
   
-- R CMD check results -------------------------- hello 0.0.0.9000 ----
Duration: 14.4s

> checking DESCRIPTION meta-information ... WARNING
  Non-standard license specification:
    `use_mit_license()`, `use_gpl3_license()` or friends to pick a
    license
  Standardizable: FALSE

> checking loading without being on the library search path ... OK
   WARNING
  'qpdf' is needed for checks on size reduction of PDFs

0 errors √ | 2 warnings x | 0 notes √

@FelicienLL
Copy link
Author

Thank you for trying. Yes, of course, there is probably something wrong with my machine. Sad that I cannot figure it out!
Would you have any idea of how I can find a workaround though? Assuming that I would always create my vignettes with the standard process (i.e. usethis::use_vignette()), would it be a problem to use devtools::check(args = c('--ignore-vignettes'), build_args = c('--no-build-vignettes')) by default?
Many thanks in advance, again.

@jennybc
Copy link
Member

jennybc commented Feb 23, 2022

Is there anything interesting about your user name or home directory path?

In terms of interpreting

E  creating vignettes (1.5s)
   Error: file 'C:/Users/le_louedec/AppData/Local/Temp/RtmpELz9qr/Rbuild38f033f814dd/bla/DESCRIPTION' is not in valid DCF format
  In addition: Warning message:
  In read.dcf(dfile, keep.white = .keep_white_description_fields) :
     cannot open compressed file 'C:/Users/le_louedec/AppData/Local/Temp/RtmpELz9qr/Rbuild38f033f814dd/bla/DESCRIPTION', probable reason 'Permission denied'

I would contemplate that the problem is non-existence of said DESCRIPTION file. And if that were the case, why is the DESCRIPTION not getting written. I'm just thinking out loud about how I would start to debug it.

@jennybc
Copy link
Member

jennybc commented Feb 23, 2022

Sounds similar to this which has never been answered:

https://stackoverflow.com/questions/36621414/adding-a-vignette-stops-devtoolscheck-from-working

And some common elements with these too:

https://stackoverflow.com/questions/48235401/error-building-vignettes-for-r-package

https://stackoverflow.com/questions/36067120/build-r-vignette-using-devtoolsbuild

Note to self: interesting differences in some of the temp parts of file paths 👆. I have no idea if those are to be expected, so could be a red herring.

@jennybc
Copy link
Member

jennybc commented Feb 23, 2022

What happens if you use R CMD check or R CMD build in the shell? I.e. remove devtools from the equation.

@FelicienLL
Copy link
Author

  • Running R CMD build from the shell works if when there is no vignette to build.
$ R CMD build hello
* checking for file 'hello/DESCRIPTION' ... OK
* preparing 'hello':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
Removed empty directory 'hello/R'
Removed empty directory 'hello/man'
* building 'hello_0.0.0.9000.tar.gz'
  • Running R CMD build from the shell fails if when there is a vignette to build, with the same error message.
$ R CMD build hello
* checking for file 'hello/DESCRIPTION' ... OK
* preparing 'hello':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Erreur : file 'C:/Users/le_louedec/AppData/Local/Temp/RtmpUVnq5c/Rbuild3a541b35227/hello/DESCRIPTION' is not in valid DCF format
De plus : Message d'avis :
Dans read.dcf(dfile, keep.white = .keep_white_description_fields) :
  impossible d'ouvrir le fichier compressé 'C:/Users/le_louedec/AppData/Local/Temp/RtmpUVnq5c/Rbuild3a541b35227/hello/DESCRIPTION', cause
probable : 'Permission denied'
Exécution arrêtée

So probably little to do with devtools indeed, and directly with R itself I guess.

@jennybc
Copy link
Member

jennybc commented Feb 24, 2022

Yes, I suspect you are experiencing some sort of infelicity in R, but you happen to have experienced it first through devtools.

@Yunuuuu
Copy link

Yunuuuu commented Mar 4, 2022

I have also problems when using remotes::install_github to install packages with argument build_vignettes = TRUE, this problem will only occur the first time I run remotes::install_github in a R session. I have raised it in r-lib/remotes#696.

@hadley hadley closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2022
@Yousuf28
Copy link

Yousuf28 commented Feb 7, 2023

Hi @FelicienLL ,
Have you been able to figured out what's the problem with the error? I am building a package and I am getting same error on my windows machine when run devtools::build(), but devtools::build() just work fine in my macbook air for the same package.

@FelicienLL
Copy link
Author

Nope. There is probably something wrong with administrator rights in my institution, although it appears I have no restriction in folders where R is installed. Sorry not to be more helpful.

@Yousuf28
Copy link

Yousuf28 commented Feb 7, 2023

Thanks for the response.
I think it is not about permission issue. When I ran the command in my personal mac it worked. I ran in linux (Rstudio server) it gave me dcf format issue error but no permission deny issue. On my windows machine (it is from employer) it gave me dcf format issue + permission issue.
So after some trial and error, I removed VignetteBuilder: knitr line from the DESCRIPTION file and everything working now with vignettes or without vignettes in devtools::build() function.

@MGousseff
Copy link

Thanks for the response. I think it is not about permission issue. When I ran the command in my personal mac it worked. I ran in linux (Rstudio server) it gave me dcf format issue error but no permission deny issue. On my windows machine (it is from employer) it gave me dcf format issue + permission issue. So after some trial and error, I removed VignetteBuilder: knitr line from the DESCRIPTION file and everything working now with vignettes or without vignettes in devtools::build() function.

I encountered the same problem and your solution worked. I wondered if it is not related to special TeX installs, as I had some problems related to this before ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants