R CMD check error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

R CMD check error

Therneau, Terry M., Ph.D.
I have a local library which depends on the expm library.  The expm library is loaded into
my personal space and I have the environment variable R_LIBS_USER set appropriately.  The
command "library(expm)" works just fine from the command line, and in fact the package
works if I do the source() and dyn.load() commands by hand.

The following sequence works:

tmt% R CMD build --no-build-vignettes hmm
tmt% R CMD INSTALL hmm*gz
tmt% R
 > library(hmm)
 >  run some commands from the hmm library

But "R CMD check hmm.gz" fails with
   ERROR: dependency ‘expm’ is not available for package ‘hmm’
* removing ‘/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm’

The R CMD build command fails similarly if I let it try to build the vignettes.

What's up?

Terry T


 > sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.8 (Final)

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error

Martyn Plummer-3
On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote:

> I have a local library which depends on the expm library.  The expm library is loaded into 
> my personal space and I have the environment variable R_LIBS_USER set appropriately.  The 
> command "library(expm)" works just fine from the command line, and in fact the package 
> works if I do the source() and dyn.load() commands by hand.
>
> The following sequence works:
>
> tmt% R CMD build --no-build-vignettes hmm
> tmt% R CMD INSTALL hmm*gz
> tmt% R
>  > library(hmm)
>  >  run some commands from the hmm library
>
> But "R CMD check hmm.gz" fails with
>    ERROR: dependency ‘expm’ is not available for package ‘hmm’
> * removing
> ‘/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm’
>
> The R CMD build command fails similarly if I let it try to build the
> vignettes.
>
> What's up?

If you are setting the environment variable R_LIBS_USER in
R_HOME/site/Renviron.site or in .Renviron then this file will not be
read when you run R CMD check or R CMD build, as R is then run with --
vanilla which implies --no-environ. 

You also need to set it in these files:

~/.R/build.Renviron
~/.R/check.Renviron

See R-exts section 1.3 and ?Startup.

Martyn
       

> Terry T
>
>
>  > sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: CentOS release 6.8 (Final)
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error

Therneau, Terry M., Ph.D.
Martin,
  I am aware of --vanilla; I use it myself for some testing.  In this case R_LIBS_USER was
set externally (part of my login) and does not involve any of the R scripts.  That means
it is inherited by any subprocess.  For example:

tmt1495% R --vanilla --no-environ

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

> system("printenv | grep R_LIBS")
R_LIBS_SITE=
R_LIBS_USER=/people/biostat2/therneau/Rlib

So, per the manual R CMD check inherits the path.  The question is why does it ignore it?

Terry T.


On 02/09/2017 02:54 AM, Martyn Plummer wrote:

> On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote:
>> I have a local library which depends on the expm library.  The expm library is loaded into
>> my personal space and I have the environment variable R_LIBS_USER set appropriately.  The
>> command "library(expm)" works just fine from the command line, and in fact the package
>> works if I do the source() and dyn.load() commands by hand.
>>
>> The following sequence works:
>>
>> tmt% R CMD build --no-build-vignettes hmm
>> tmt% R CMD INSTALL hmm*gz
>> tmt% R
>>   > library(hmm)
>>   >  run some commands from the hmm library
>>
>> But "R CMD check hmm.gz" fails with
>>     ERROR: dependency ‘expm’ is not available for package ‘hmm’
>> * removing
>> ‘/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm’
>>
>> The R CMD build command fails similarly if I let it try to build the
>> vignettes.
>>
>> What's up?
>
> If you are setting the environment variable R_LIBS_USER in
> R_HOME/site/Renviron.site or in .Renviron then this file will not be
> read when you run R CMD check or R CMD build, as R is then run with --
> vanilla which implies --no-environ.
>
> You also need to set it in these files:
>
> ~/.R/build.Renviron
> ~/.R/check.Renviron
>
> See R-exts section 1.3 and ?Startup.
>
> Martyn
>
>> Terry T
>>
>>
>>   > sessionInfo()
>> R version 3.3.1 (2016-06-21)
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> Running under: CentOS release 6.8 (Final)
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error

Martyn Plummer-3
On Thu, 2017-02-09 at 09:52 -0600, Therneau, Terry M., Ph.D. wrote:

> Martin,
>   I am aware of --vanilla; I use it myself for some testing.  In this case R_LIBS_USER was 
> set externally (part of my login) and does not involve any of the R scripts.  That means 
> it is inherited by any subprocess.  For example:
>
> tmt1495% R --vanilla --no-environ
>
> R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> >
> > system("printenv | grep R_LIBS")
> R_LIBS_SITE=
> R_LIBS_USER=/people/biostat2/therneau/Rlib
>
> So, per the manual R CMD check inherits the path.  The question is
> why does it ignore it?

Hmmm. Perhaps it is being overwritten.  Does this work?

$ export R_CHECK_ENVIRON=
$ R CMD check hmm.gz

Martyn

> Terry T.
>
>
> On 02/09/2017 02:54 AM, Martyn Plummer wrote:
> >
> > On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote:
> > >
> > > I have a local library which depends on the expm library.  The expm library is loaded into
> > > my personal space and I have the environment variable R_LIBS_USER set appropriately.  The
> > > command "library(expm)" works just fine from the command line, and in fact the package
> > > works if I do the source() and dyn.load() commands by hand.
> > >
> > > The following sequence works:
> > >
> > > tmt% R CMD build --no-build-vignettes hmm
> > > tmt% R CMD INSTALL hmm*gz
> > > tmt% R
> > >   > library(hmm)
> > >   >  run some commands from the hmm library
> > >
> > > But "R CMD check hmm.gz" fails with
> > >     ERROR: dependency ‘expm’ is not available for package ‘hmm’
> > > * removing
> > > ‘/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm’
> > >
> > > The R CMD build command fails similarly if I let it try to build the
> > > vignettes.
> > >
> > > What's up?
> >
> > If you are setting the environment variable R_LIBS_USER in
> > R_HOME/site/Renviron.site or in .Renviron then this file will not be
> > read when you run R CMD check or R CMD build, as R is then run with --
> > vanilla which implies --no-environ.
> >
> > You also need to set it in these files:
> >
> > ~/.R/build.Renviron
> > ~/.R/check.Renviron
> >
> > See R-exts section 1.3 and ?Startup.
> >
> > Martyn
> >
> > >
> > > Terry T
> > >
> > >
> > >   > sessionInfo()
> > > R version 3.3.1 (2016-06-21)
> > > Platform: x86_64-pc-linux-gnu (64-bit)
> > > Running under: CentOS release 6.8 (Final)
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error

Therneau, Terry M., Ph.D.
Martyn,
   No, that didn't work.
   One other thing in the mix (which I don't think is the issue) is that I call one of the
C-entry points of expm.  So the DESCRIPTION file imports expm, the NAMESPACE file imports
expm, and the init.c file is

#include "R.h"
#include "R_ext/Rdynload.h"

/* Interface to expm package. */
typedef enum {Ward_2, Ward_1, Ward_buggy_octave} precond_type;
void (*expm)(double *x, int n, double *z, precond_type precond_kind);
void R_init_hmm(DllInfo *dll)
{
     expm = (void (*)) R_GetCCallable("expm", "expm");
}

I don't expect that this is the problem since I stole the above almost verbatim from the
msm package.

Terry T.


On 02/09/2017 11:23 AM, Martyn Plummer wrote:

> On Thu, 2017-02-09 at 09:52 -0600, Therneau, Terry M., Ph.D. wrote:
>> Martin,
>>    I am aware of --vanilla; I use it myself for some testing.  In this case R_LIBS_USER was
>> set externally (part of my login) and does not involve any of the R scripts.  That means
>> it is inherited by any subprocess.  For example:
>>
>> tmt1495% R --vanilla --no-environ
>>
>> R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
>> Copyright (C) 2016 The R Foundation for Statistical Computing
>> Platform: x86_64-pc-linux-gnu (64-bit)
>>
>>>
>>> system("printenv | grep R_LIBS")
>> R_LIBS_SITE=
>> R_LIBS_USER=/people/biostat2/therneau/Rlib
>>
>> So, per the manual R CMD check inherits the path.  The question is
>> why does it ignore it?
>
> Hmmm. Perhaps it is being overwritten.  Does this work?
>
> $ export R_CHECK_ENVIRON=
> $ R CMD check hmm.gz
>
> Martyn
>
>> Terry T.
>>
>>
>> On 02/09/2017 02:54 AM, Martyn Plummer wrote:
>>>
>>> On Wed, 2017-02-08 at 15:51 -0600, Therneau, Terry M., Ph.D. wrote:
>>>>
>>>> I have a local library which depends on the expm library.  The expm library is loaded into
>>>> my personal space and I have the environment variable R_LIBS_USER set appropriately.  The
>>>> command "library(expm)" works just fine from the command line, and in fact the package
>>>> works if I do the source() and dyn.load() commands by hand.
>>>>
>>>> The following sequence works:
>>>>
>>>> tmt% R CMD build --no-build-vignettes hmm
>>>> tmt% R CMD INSTALL hmm*gz
>>>> tmt% R
>>>>    > library(hmm)
>>>>    >  run some commands from the hmm library
>>>>
>>>> But "R CMD check hmm.gz" fails with
>>>>      ERROR: dependency ‘expm’ is not available for package ‘hmm’
>>>> * removing
>>>> ‘/people/biostat2/therneau/consult/alzheimer/hmm.Rcheck/hmm’
>>>>
>>>> The R CMD build command fails similarly if I let it try to build the
>>>> vignettes.
>>>>
>>>> What's up?
>>>
>>> If you are setting the environment variable R_LIBS_USER in
>>> R_HOME/site/Renviron.site or in .Renviron then this file will not be
>>> read when you run R CMD check or R CMD build, as R is then run with --
>>> vanilla which implies --no-environ.
>>>
>>> You also need to set it in these files:
>>>
>>> ~/.R/build.Renviron
>>> ~/.R/check.Renviron
>>>
>>> See R-exts section 1.3 and ?Startup.
>>>
>>> Martyn
>>>
>>>>
>>>> Terry T
>>>>
>>>>
>>>>    > sessionInfo()
>>>> R version 3.3.1 (2016-06-21)
>>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>>> Running under: CentOS release 6.8 (Final)
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error (interfacing to C API of other pkg)

Martin Maechler
>>>>> Therneau, Terry M , Ph D <[hidden email]>
>>>>>     on Thu, 9 Feb 2017 12:56:17 -0600 writes:

    > Martyn,
    > No, that didn't work.
    > One other thing in the mix (which I don't think is the issue) is that I call one of the
    > C-entry points of expm.  So the DESCRIPTION file imports expm, the NAMESPACE file imports
    > expm, and the init.c file is

    > #include "R.h"
    > #include "R_ext/Rdynload.h"

    > /* Interface to expm package. */
    > typedef enum {Ward_2, Ward_1, Ward_buggy_octave} precond_type;
    > void (*expm)(double *x, int n, double *z, precond_type precond_kind);
    > void R_init_hmm(DllInfo *dll)
    > {
    >      expm = (void (*)) R_GetCCallable("expm", "expm");
    > }

    > I don't expect that this is the problem since I stole the
    > above almost verbatim from the msm package.

    > Terry T.

Hmm.  Yes, I can see that the CRAN package  msm  does do this, indeed.

It is interesting if/why that does not produce any notes or rather even warnings.
In principle, if you use the C API of 'expm'  you should use
  'LinkingTo: expm'

see *the* manual, specifically the section

    https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Linking-to-native-routines-in-other-packages

and that section does mention that (unfortunately in my view)
you also should use 'Imports:' or 'Depends:' in addition to the 'LinkingTo:'

Note howver that  'expm' would not have to mentioned
in the NAMESPACE file.... unless your R functions do use some of
expm's R level functionality.


Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: R CMD check error (interfacing to C API of other pkg): Solved

Therneau, Terry M., Ph.D.
Martin,
   That was it-  I forgot the "LinkingTo" line.  I had read that section of the manual
twice in the last 2 days, yet somehow missed that critical line both times.  And even
worse, the final sentence of said section references my own coxme package as an example of
how to do it correctly!

Thank you all for the help.  My only remaining defense, but a very weak one, is that the
error message could have been better since it led me to believe that R couldn't find the
library at all.

Terry Therneau

On 02/10/2017 10:26 AM, Martin Maechler wrote:

>>>>>> Therneau, Terry M , Ph D <[hidden email]>
>>>>>>      on Thu, 9 Feb 2017 12:56:17 -0600 writes:
>
>      > Martyn,
>      > No, that didn't work.
>      > One other thing in the mix (which I don't think is the issue) is that I call one of the
>      > C-entry points of expm.  So the DESCRIPTION file imports expm, the NAMESPACE file imports
>      > expm, and the init.c file is
>
>      > #include "R.h"
>      > #include "R_ext/Rdynload.h"
>
>      > /* Interface to expm package. */
>      > typedef enum {Ward_2, Ward_1, Ward_buggy_octave} precond_type;
>      > void (*expm)(double *x, int n, double *z, precond_type precond_kind);
>      > void R_init_hmm(DllInfo *dll)
>      > {
>      >      expm = (void (*)) R_GetCCallable("expm", "expm");
>      > }
>
>      > I don't expect that this is the problem since I stole the
>      > above almost verbatim from the msm package.
>
>      > Terry T.
>
> Hmm.  Yes, I can see that the CRAN package  msm  does do this, indeed.
>
> It is interesting if/why that does not produce any notes or rather even warnings.
> In principle, if you use the C API of 'expm'  you should use
>    'LinkingTo: expm'
>
> see *the* manual, specifically the section
>
>      https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Linking-to-native-routines-in-other-packages
>
> and that section does mention that (unfortunately in my view)
> you also should use 'Imports:' or 'Depends:' in addition to the 'LinkingTo:'
>
> Note howver that  'expm' would not have to mentioned
> in the NAMESPACE file.... unless your R functions do use some of
> expm's R level functionality.
>
>
> Martin
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel