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

unable to find required package ‘roxygen_devtest’ #595

Closed
unDocUMeantIt opened this issue Feb 20, 2017 · 23 comments
Closed

unable to find required package ‘roxygen_devtest’ #595

unDocUMeantIt opened this issue Feb 20, 2017 · 23 comments
Labels

Comments

@unDocUMeantIt
Copy link

@unDocUMeantIt unDocUMeantIt commented Feb 20, 2017

i'm suddenly getting this error message after upgrading to 6.0.1 when i'm trying to roxygenize() a package (called via roxygen2::roxygenize() from inside another package)

Error in .requirePackage(package) :
  unable to find required package ‘roxygen_devtest’

any ideas what causes this and how it can be fixed?

@unDocUMeantIt
Copy link
Author

@unDocUMeantIt unDocUMeantIt commented Feb 21, 2017

actually it doesn't matter how i call roxygenize() (R 3.3.2, roxygen2 6.0.1), the error is permanent whenever i try to rebuild the docs for https://github.com/unDocUMeantIt/koRpus/tree/develop

@unDocUMeantIt
Copy link
Author

@unDocUMeantIt unDocUMeantIt commented Feb 25, 2017

i guess i could pin down the root of the problem, by making a copy of the package with an empty R directory and then adding one R file after the other between rogygenize() runs, to see where it breaks.

it took four files: as soon as the S4 class definition in file 01_class_03_kRp.txt.freq.R is being added, i get the above error; when i remove it all goes fine again.

the setClass() call in that file differs from the previous two in that it includes the option contains=c("kRp.tagged"). this inherited class is being defined two files earlier, and that file is also referenced via @include 01_class_01_kRp.tagged.R.

to further test this, i've removed the contains= option and added the then missing slots -- the error is gone. so, i've either used inheritance wrongly, or roxygen has a bug dealing with it correctly. which one is it?

@ghost
Copy link

@ghost ghost commented Feb 27, 2017

I've been getting this problem too. I changed to devtools::document() which fixed things.

@unDocUMeantIt
Copy link
Author

@unDocUMeantIt unDocUMeantIt commented Feb 28, 2017

i can confirm that calling devtools::document() does indeed work without errors.

however, i wouldn't conider it a fix, it's a workaround depending on another package. whatever magic devtools has to apply here to make rogygenize() comply as expected, this should of course be dealt with by roxygen2 in the first place.

@ghost
Copy link

@ghost ghost commented Feb 28, 2017

I certainly agree. I just have no idea how to isolate or fix the problem nor why some people get it and other don't. So for now...I'm working around in all of my packages

@lgatto
Copy link

@lgatto lgatto commented Mar 6, 2017

I have experienced the same issue, which is documented here, in case this is helpful.

@unDocUMeantIt
Copy link
Author

@unDocUMeantIt unDocUMeantIt commented Mar 6, 2017

FWIW, i've patched roxyPackage to be able to apply the workaround.

@rguliev
Copy link

@rguliev rguliev commented Mar 8, 2017

I've experienced it too. Two options I found:

  1. use devtools::document() (as already suggested)
  2. use older version of roxygen: devtools::install_version(package = 'roxygen2',version = '5.0.1', repos = c(CRAN = "https://cran.rstudio.com")) (see this issue)

@bbolker
Copy link

@bbolker bbolker commented Apr 26, 2017

bump?

@Fablepongiste
Copy link

@Fablepongiste Fablepongiste commented May 31, 2017

Is this looked into by any roxygen2 maintainer ? @hadley @klutometis ?
I understand the devtools work around but still believe should be handled fine by roxygen2 directly ?

@romanzenka
Copy link

@romanzenka romanzenka commented Jun 14, 2017

My RStudio build just broke because of upgrade to newer roxygen2 with this error. I work with people who just push the Build > Document button so a devtools workaround or installing an older version is an quite an annoyance for the team. This just needs to work.

@hadley
Copy link
Member

@hadley hadley commented Jun 14, 2017

roxygenise(".") works for me so the first step would be to create a minimal reprex using the reprex package.

@ghost
Copy link

@ghost ghost commented Jun 14, 2017

I fully appreciate that it's working your system Hadley. I wonder if it's something with our DESCRIPTION that might be funky? I don't know what else you'd like to see here or what might be helpful.

> roxygenize(".")
Loading required package: roxygen_devtest
Error in .requirePackage(package) : 
  unable to find required package ‘roxygen_devtest’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘roxygen_devtest’

For some reason devtools::document() works just fine

@hadley
Copy link
Member

@hadley hadley commented Jun 14, 2017

@pan0ramic well it would be helpful to know what package you were running it on 😉

A traceback() and devtools::session_info() would also be useful

@ghost
Copy link

@ghost ghost commented Jun 14, 2017

@hadley Thanks for being patient. I'm running this on a company package that isn't OS (related to calling our internal APIs). Here's my traceback(), I hope it helps. Looks like it's something related to Reference Classes? I'm happy to help troubleshoot further if it would be useful.

13: stop(gettextf("unable to find required package %s", sQuote(package)), 
    domain = NA)
12: .requirePackage(package)
11: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
10: makeClassRepresentation(Class, properties, superClasses, prototype, 
        package, validity, access, version, sealed, where = where)
9: setClass(Class, contains = superClasses, where = where, ...)
8: setRefClass(Class = "abstract.model.request", fields = list(request = "list", 
       <<removing the code from the RefClass>>
7: eval(expr, envir, enclos)
6: eval(expr, envir = envir)
5: FUN(X[[i]], ...)
4: lapply(paths, sys_source, envir = env, fileEncoding = desc$Encoding %||% 
       "UTF-8")
3: load_code(base_path)
2: parse_package(base_path, load_code, registry, options)
1: roxygenize(".")

Session Info:

Session info ---------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.0 (2016-05-03)
 system   x86_64, darwin13.4.0        
 ui       RStudio (1.0.136)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2017-06-14                  

Packages -------------------------------------------------------------------------------------------------------------
 package     * version date       source        
 assertthat  * 0.2.0   2017-04-11 CRAN (R 3.3.0)
 backports     1.1.0   2017-05-22 CRAN (R 3.3.0)
 base        * 3.3.0   2016-05-03 local         
 codetools     0.2-15  2016-10-05 CRAN (R 3.3.0)
 colorspace    1.3-2   2016-12-14 CRAN (R 3.3.0)
 commonmark    1.2     2017-03-01 CRAN (R 3.3.0)
 crayon        1.3.2   2016-06-28 CRAN (R 3.3.0)
 data.table    1.10.4  2017-02-01 CRAN (R 3.3.0)
 datasets    * 3.3.0   2016-05-03 local         
 DBI           0.6-1   2017-04-01 CRAN (R 3.3.0)
 desc          1.1.0   2017-01-27 CRAN (R 3.3.2)
 devtools    * 1.13.2  2017-06-02 CRAN (R 3.3.0)
 digest      * 0.6.12  2017-01-27 CRAN (R 3.3.0)
 dplyr       * 0.5.0   2016-06-24 CRAN (R 3.3.0)
 foreach     * 1.4.3   2015-10-13 CRAN (R 3.3.0)
 ggplot2     * 2.2.1   2016-12-30 CRAN (R 3.3.0)
 graphics    * 3.3.0   2016-05-03 local         
 grDevices   * 3.3.0   2016-05-03 local         
 grid          3.3.0   2016-05-03 local         
 gridExtra   * 2.2.1   2016-02-29 CRAN (R 3.3.0)
 gtable        0.2.0   2016-02-26 CRAN (R 3.3.0)
 htmltools     0.3.6   2017-04-28 CRAN (R 3.3.0)
 httpuv        1.3.3   2015-08-04 CRAN (R 3.3.0)
 httr        * 1.2.1   2016-07-03 CRAN (R 3.3.0)
 iterators     1.0.8   2015-10-13 CRAN (R 3.3.0)
 jsonlite    * 1.5     2017-06-01 CRAN (R 3.3.0)
 lattice       0.20-35 2017-03-25 CRAN (R 3.3.0)
 lazyeval      0.2.0   2016-06-12 CRAN (R 3.3.0)
 logging     * 0.7-103 2013-04-12 CRAN (R 3.3.0)
 lubridate   * 1.6.0   2016-09-13 CRAN (R 3.3.0)
 magrittr    * 1.5     2014-11-22 CRAN (R 3.3.0)
 MASS          7.3-47  2017-04-21 CRAN (R 3.3.0)
 memoise       1.1.0   2017-04-21 CRAN (R 3.3.0)
 methods     * 3.3.0   2016-05-03 local         
 mime          0.5     2016-07-07 CRAN (R 3.3.0)
 munsell       0.4.3   2016-02-13 CRAN (R 3.3.0)
 plyr        * 1.8.4   2016-06-08 CRAN (R 3.3.0)
 pryr        * 0.1.2   2015-06-20 CRAN (R 3.3.0)
 R6            2.2.1   2017-05-10 CRAN (R 3.3.0)
 Rcpp          0.12.11 2017-05-22 CRAN (R 3.3.0)
 reshape2    * 1.4.2   2016-10-22 CRAN (R 3.3.0)
 rjson       * 0.2.15  2014-11-03 CRAN (R 3.3.0)
 rlang         0.1.1   2017-05-18 CRAN (R 3.3.0)
 rlist       * 0.4.6.1 2016-04-04 CRAN (R 3.3.0)
 roxygen2    * 6.0.1   2017-02-06 CRAN (R 3.3.0)
 rprojroot     1.2     2017-01-16 CRAN (R 3.3.0)
 scales        0.4.1   2016-11-09 CRAN (R 3.3.0)
 shiny       * 1.0.3   2017-04-26 CRAN (R 3.3.0)
 soiltexture * 1.4.1   2016-06-07 CRAN (R 3.3.0)
 sp            1.2-4   2016-12-22 CRAN (R 3.3.0)
 stats       * 3.3.0   2016-05-03 local         
 stringi       1.1.5   2017-04-07 CRAN (R 3.3.0)
 stringr     * 1.2.0   2017-02-18 CRAN (R 3.3.0)    
 tcltk         3.3.0   2016-05-03 local         
 testthat      1.0.2   2016-04-23 CRAN (R 3.3.0)
 tibble        1.3.3   2017-05-28 CRAN (R 3.3.0)
 tidyr       * 0.6.3   2017-05-15 CRAN (R 3.3.0)
 tools         3.3.0   2016-05-03 local         
 utils       * 3.3.0   2016-05-03 local         
 withr         1.0.2   2016-06-20 CRAN (R 3.3.0)
 xml2          1.1.1   2017-01-24 CRAN (R 3.3.0)
 xtable        1.8-2   2016-02-05 CRAN (R 3.3.0)

@hadley
Copy link
Member

@hadley hadley commented Jun 14, 2017

@pan0ramic hmmm, I bet it is RC related. Could you please see if you can reproduce the problem in a package that just has a single simple RC class?

@unDocUMeantIt
Copy link
Author

@unDocUMeantIt unDocUMeantIt commented Jun 15, 2017

i originally reported this issue and i don't use RC at all. i also already provided the failing package code (https://github.com/unDocUMeantIt/koRpus/tree/develop) a few months ago and explained how the problem can be triggered in previous comments (inheriting via "contains" in S4 classes).

@ghost
Copy link

@ghost ghost commented Jun 15, 2017

@hadley I was able to reproduce quite easily in the end.

  • Create a new package in Rstudio.
  • Replace the hello.R code with a single line: setRefClass(Class = "foo")
  • roxygen2::roxygenise(".")

And you get the error below.

I appreciate your time; please let me know if I can be of further help here.

13: stop(gettextf("unable to find required package %s", sQuote(package)), 
        domain = NA)
12: .requirePackage(package)
11: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
10: makeClassRepresentation(Class, properties, superClasses, prototype, 
        package, validity, access, version, sealed, where = where)
9: setClass(Class, contains = superClasses, where = where, ...)
8: setRefClass(Class = "foo")
7: eval(expr, envir, enclos)
6: eval(expr, envir = envir)
5: FUN(X[[i]], ...)
4: lapply(paths, sys_source, envir = env, fileEncoding = desc$Encoding %||% 
       "UTF-8")
3: load_code(base_path)
2: parse_package(base_path, load_code, registry, options)
1: roxygen2::roxygenise(".")

@hadley
Copy link
Member

@hadley hadley commented Jun 15, 2017

@pan0ramic thanks for the helping creating a minimal reprex. @unDocUMeantIt sorry I missed your reprex, but I read a lot of issues in a day, and your reprex was not very obvious.

The root cause is this:

env <- new.env(parent = globalenv())
methods::setPackageName("roxygen_devtest", env)

evalq(envir = env, {
  setClass("A")
  setClass("B", contains = "A")
})

in source_package(). But this code hasn't change substantially for years. It would be helpful if someone would do a git bisect to figure out exactly when this bug occurred.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Aug 16, 2017

8d879e9 seems to be the first bad commit

@hadley
Copy link
Member

@hadley hadley commented Aug 16, 2017

@krlmlr thanks! I bet it's the switch from source to sys.source

Anyway, I'm going to remove source_package() and replace it with pkgload::load_all(). That gives a much better simulation of package loading and will avoid devtools::document() and roxygenise() having different behaviours.

@waflessnet
Copy link

@waflessnet waflessnet commented Apr 11, 2018

@rguliev Thanks !! your are machine !! , and 5.0.1 work ..but i use : devtools::install_version(package = 'roxygen2',version = '5.0.1', repos ='http://cran.us.r-project.org')

@privefl
Copy link

@privefl privefl commented Aug 13, 2018

I got the same issue today.
Seems like installing devtools solved it for me.

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

Successfully merging a pull request may close this issue.

None yet
10 participants