Loading package fails on setOldClass #568

Closed
renozao opened this Issue Jan 27, 2017 · 11 comments

Comments

Projects
None yet
7 participants
@renozao
Contributor

renozao commented Jan 27, 2017

For the record only, because I realized that things works fine with devtools::document.

If the package to document contains a call to setOldClass, then roxygenise fails with the following error:

Loading required package: roxygen_devtest
Error in .requirePackage(package) : 
  unable to find required packageroxygen_devtestIn addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package calledroxygen_devtest

traceback shows:

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(cl, contains = c(prevClass, "VIRTUAL"), where = where)
8: setOldClass("A")
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("~/projects/tmp/A")
@jpritikin

This comment has been minimized.

Show comment
Hide comment
@jpritikin

jpritikin Feb 1, 2017

Hm, so until this is fixed, the workaround is to use devtools::document? But I definitely don't want to wait for all the C++ source code to compile. Is there some other way to persuade roxygen2::roxygenise to work?

jpritikin commented Feb 1, 2017

Hm, so until this is fixed, the workaround is to use devtools::document? But I definitely don't want to wait for all the C++ source code to compile. Is there some other way to persuade roxygen2::roxygenise to work?

nealrichardson added a commit to Crunch-io/rcrunch that referenced this issue Feb 2, 2017

@pan0ramic

This comment has been minimized.

Show comment
Hide comment
@pan0ramic

pan0ramic Feb 4, 2017

FWIW: I'm also seeing this problem when I try build my NAMESPACE. The method I use is

echo "library(roxygen2); roxygenize('.')" | R --slave

Which worked just fine with 5.x.x, but now breaks with the error that was reported above (cannot find roxygen_devtest)

FWIW: I'm also seeing this problem when I try build my NAMESPACE. The method I use is

echo "library(roxygen2); roxygenize('.')" | R --slave

Which worked just fine with 5.x.x, but now breaks with the error that was reported above (cannot find roxygen_devtest)

@jpritikin

This comment has been minimized.

Show comment
Hide comment
@jpritikin

jpritikin Feb 8, 2017

Can we get some kind of estimate of when this might be fixed? Is it a big problem requiring lots of substantial development or, potentially, a 1 line fix?

Can we get some kind of estimate of when this might be fixed? Is it a big problem requiring lots of substantial development or, potentially, a 1 line fix?

@GuangchuangYu

This comment has been minimized.

Show comment
Hide comment
@GuangchuangYu

GuangchuangYu Feb 15, 2017

have similar issue here.

It works when I re-install old version (5.0.1).

have similar issue here.

It works when I re-install old version (5.0.1).

@jpritikin

This comment has been minimized.

Show comment
Hide comment
@jpritikin

jpritikin Feb 16, 2017

Hm, I was using the old class packageVersion. I guess it is simple enough to apply as.character and pacakge_version as needed to avoid storing this class in an object.

Hm, I was using the old class packageVersion. I guess it is simple enough to apply as.character and pacakge_version as needed to avoid storing this class in an object.

HenrikBengtsson added a commit to HenrikBengtsson/BiocParallel.FutureParam that referenced this issue Feb 19, 2017

@alejandro-sotolongo

This comment has been minimized.

Show comment
Hide comment
@alejandro-sotolongo

alejandro-sotolongo Mar 4, 2017

I noticed this problem too when my package had other (non-related) errors that prevented it from being built. After correcting the other errors and rebuilding the package roxygenize worked fine.

I noticed this problem too when my package had other (non-related) errors that prevented it from being built. After correcting the other errors and rebuilding the package roxygenize worked fine.

@bbolker

This comment has been minimized.

Show comment
Hide comment
@bbolker

bbolker Apr 9, 2017

Still having this with latest (as of today) version from GitHub installed,

The devtools::document() workaround works for me.

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’
> roxygenise("Rpkg")
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’
> traceback()
12: stop(gettextf("unable to find required package %s", sQuote(package)), 
        domain = NA)
11: .requirePackage(package)
10: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
9: makeClassRepresentation(Class, properties, contains, prototype, 
       package, validity, access, version, sealed, where = where)
8: setClass("TransformedModel", contains = "Model", slots = c(transforms = "list", 
       inverses = "list"))
7: eval(expr, envir = envir)
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: roxygenise("Rpkg")

bbolker commented Apr 9, 2017

Still having this with latest (as of today) version from GitHub installed,

The devtools::document() workaround works for me.

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’
> roxygenise("Rpkg")
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’
> traceback()
12: stop(gettextf("unable to find required package %s", sQuote(package)), 
        domain = NA)
11: .requirePackage(package)
10: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
9: makeClassRepresentation(Class, properties, contains, prototype, 
       package, validity, access, version, sealed, where = where)
8: setClass("TransformedModel", contains = "Model", slots = c(transforms = "list", 
       inverses = "list"))
7: eval(expr, envir = envir)
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: roxygenise("Rpkg")
@hadley

This comment has been minimized.

Show comment
Hide comment
@hadley

hadley Aug 16, 2017

Collaborator

We should be able to fix this now that the package loading simulation has been extracted out of devtools and into pkgload. However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

Collaborator

hadley commented Aug 16, 2017

We should be able to fix this now that the package loading simulation has been extracted out of devtools and into pkgload. However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

@hadley hadley added the feature label Aug 16, 2017

@hadley hadley closed this in bd0875c Aug 17, 2017

@jpritikin

This comment has been minimized.

Show comment
Hide comment
@jpritikin

jpritikin Aug 17, 2017

However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

That's disappointing. Is there some way to invoke roxygen2 to tell it that we don't care about C++ functions and compilation can be skipped?

However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

That's disappointing. Is there some way to invoke roxygen2 to tell it that we don't care about C++ functions and compilation can be skipped?

@hadley

This comment has been minimized.

Show comment
Hide comment
@hadley

hadley Aug 17, 2017

Collaborator

I don't understand why it's a problem because you only need to recompile when the C++ code changes.

Collaborator

hadley commented Aug 17, 2017

I don't understand why it's a problem because you only need to recompile when the C++ code changes.

@jpritikin

This comment has been minimized.

Show comment
Hide comment
@jpritikin

jpritikin Aug 17, 2017

Oh! That is an improvement. I'll let you know how things go.

Oh! That is an improvement. I'll let you know how things go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment