[Bioc-devel] import except on Window Machine

Michael Lawrence lawrence.michael at gene.com
Tue Apr 12 01:27:58 CEST 2016


On Mon, Apr 11, 2016 at 2:54 PM, Hervé Pagès <hpages at fredhutch.org> wrote:
> Hi Michael,
>
> On 04/11/2016 01:23 PM, Michael Lawrence wrote:
>>
>> Yes, you're right, sorry. I didn't realize that the generic is always
>> exported from a package defining methods on the generic.
>
>
> What's the rationale behind this feature?

As stated in Writing R Extensions, it is to ensure that the user sees
the generic for the exported methods, even when the package defining
the generic is not attached. I guess another way would be to have the
package with the generic be partially attached, only exposing the
generics with exported methods.

> It seems to be a recurrent
> source of surprise and confusion. In the last couple of years I must
> have fixed dozens (maybe 100+) of NAMESPACEs that import things from
> the wrong place, that is, what the maintainer of the package actually
> needs and should import is the foo() generic from package A, but s/he
> imports a particular method from package B instead. Sometimes that
> method is not even the one that they actually need. *Unfortunately*
> things work for a while but break later when the random method they
> import disappears from package B.
>
> One almost always calls the generic, not a particular method directly.
> So personally I never use importMethodsFrom. Don't see the need for it.
> I don't even know what it does i.e. what importing a method means
> exactly. AFAIK when I call the generic, dispatch on the appropriate
> method works, whether I "import" that method or not...

I agree that explicitly importing and exporting methods may not be very useful.

exportMethods() and importMethodsFrom() do help when making generics
internal, because export(generic)/import(generic) would end up
importing/exporting a base function (since a compatible setGeneric()
is a no-op). But there's basically one person who makes generics
internal, and he's not doing so very often.

>
> Getting the NAMESPACE right has always been a source of struggle
> for developers. Simplifying and clarifying some of the concepts
> involved would help make the process a little more straightforward.
>

> Thanks,
> H.
>
>
>> That can make
>> the exceptions more difficult to maintain. A better syntax for this
>> case might have been:
>>
>> import(cranPackage, override=values)
>>
>> But we have to live with except= for now.
>>
>> Michael
>>
>> On Mon, Apr 11, 2016 at 12:25 PM, Zhu, Lihua (Julie)
>> <Julie.Zhu at umassmed.edu> wrote:
>>>
>>> Thanks Michael!
>>>
>>> FYI, I would get a warning message if I did not use import(IRanges,
>>> except=values).
>>>
>>> Best,
>>>
>>> Julie
>>>
>>> On 4/11/16 2:40 PM, "Michael Lawrence" <lawrence.michael at gene.com> wrote:
>>>
>>>> On Mon, Apr 11, 2016 at 10:28 AM, Dan Tenenbaum <dtenenba at fredhutch.org>
>>>> wrote:
>>>>>
>>>>> In that output you sent me, it's still using roxygen (via devtools) to
>>>>> create the namespace. Try creating it manually and see if you still get
>>>>> the same error.
>>>>>
>>>>> What does your NAMESPACE look like anyway?
>>>>>
>>>>> Looking at the NAMESPACE for CRISPRseek, the instances of the 'except'
>>>>> syntax look like this:
>>>>>
>>>>> import(S4Vectors, except=c(fold, values))
>>>>> import(IRanges, except=values)
>>>>
>>>>
>>>> Unrelated note: should be no need to exclude values from IRanges. It
>>>> is S4Vectors that exports the generic.
>>>>
>>>>>
>>>>> So maybe make sure the objects to be excepted are not quoted?
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>>>
>>>>>> From: "Karim Mezhoud" <kmezhoud at gmail.com>
>>>>>> To: "Dan Tenenbaum" <dtenenba at fredhutch.org>
>>>>>> Cc: "Lihua Zhu" <Julie.Zhu at umassmed.edu>, "Michael Lawrence"
>>>>>> <lawrence.michael at gene.com>, "bioc-devel"
>>>>>> <bioc-devel at r-project.org>
>>>>>> Sent: Monday, April 11, 2016 10:21:42 AM
>>>>>> Subject: Re: [Bioc-devel] import except on Window Machine
>>>>>
>>>>>
>>>>>> ##### ##    BUILT &   RELOAD
>>>>>> ==> R CMD INSTALL --no-multiarch --with-keep.source bioCancer
>>>>>>
>>>>>> * installing to library
>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library¹
>>>>>> ERROR: failed to lock directory
>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library¹ for
>>>>>> modifying
>>>>>> Try removing
>>>>>>
>>>>>>
>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library/00LOCK-b
>>>>>> ioCancer¹
>>>>>>
>>>>>> Exited with status 3.
>>>>>>
>>>>>> ######## BUILT SOURCE PACKAGE
>>>>>> ==> devtools::document(roclets=c('rd', 'collate', 'namespace'))
>>>>>>
>>>>>> Updating bioCancer documentation
>>>>>> Loading bioCancer
>>>>>> Documentation completed
>>>>>>
>>>>>> ==> devtools::build()
>>>>>>
>>>>>> '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file
>>>>>> --no-environ  \
>>>>>>   --no-save --no-restore CMD build '/Volumes/DATA/radiant/bioCancer'
>>>>>> \
>>>>>>   --no-resave-data --no-manual
>>>>>>
>>>>>> * checking for file Œ/Volumes/DATA/radiant/bioCancer/DESCRIPTION¹ ...
>>>>>> OK
>>>>>> * preparing ŒbioCancer¹:
>>>>>> * checking DESCRIPTION meta-information ... OK
>>>>>> * checking for LF line-endings in source and make files
>>>>>> * checking for empty or unneeded directories
>>>>>> * building ŒbioCancer_0.99.0.tar.gz¹
>>>>>>
>>>>>> [1] "/Volumes/DATA/radiant/bioCancer_0.99.0.tar.gz"
>>>>>>
>>>>>> Source package written to /Volumes/DATA/radiant
>>>>>>
>>>>>> On Mon, Apr 11, 2016 at 6:10 PM, Dan Tenenbaum
>>>>>> <dtenenba at fredhutch.org>
>>>>>> wrote:
>>>>>>
>>>>>>> roxygen2 does not support the new syntax. Do you still get the same
>>>>>>> error
>>>>>>> if you write your NAMESPACE manually?
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>>>
>>>>>>>> From: "Karim Mezhoud" <kmezhoud at gmail.com>
>>>>>>>> To: "Dan Tenenbaum" <dtenenba at fredhutch.org>
>>>>>>>> Cc: "Lihua Zhu" <Julie.Zhu at umassmed.edu>, "Michael Lawrence" <
>>>>>>>
>>>>>>> lawrence.michael at gene.com>, "bioc-devel"
>>>>>>>>
>>>>>>>> <bioc-devel at r-project.org>
>>>>>>>> Sent: Monday, April 11, 2016 10:08:15 AM
>>>>>>>> Subject: Re: [Bioc-devel] import except on Window Machine
>>>>>>>
>>>>>>>
>>>>>>>>> sessionInfo()
>>>>>>>>
>>>>>>>> R version 3.3.0 beta (2016-04-06 r70435)
>>>>>>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>>>>>>> Running under: OS X 10.11.3 (El Capitan)
>>>>>>>>
>>>>>>>> locale:
>>>>>>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Apr 11, 2016 at 6:07 PM, Dan Tenenbaum
>>>>>>>
>>>>>>> <dtenenba at fredhutch.org>
>>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Karim, What is the sessionInfo() in your R-3.3? It might be too
>>>>>>>
>>>>>>> old to
>>>>>>>>>
>>>>>>>>> have the new feature. It needs to be at svn rev r70426 or newer.
>>>>>>>>>
>>>>>>>>> Dan
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ----- Original Message -----
>>>>>>>>>>
>>>>>>>>>> From: "Karim Mezhoud" <kmezhoud at gmail.com>
>>>>>>>>>> To: "Lihua Zhu" <Julie.Zhu at umassmed.edu>
>>>>>>>>>> Cc: "Dan Tenenbaum" <dtenenba at fredhutch.org>, "Michael Lawrence"
>>>>>>>
>>>>>>> <
>>>>>>>>>
>>>>>>>>> lawrence.michael at gene.com>, "bioc-devel"
>>>>>>>>>>
>>>>>>>>>> <bioc-devel at r-project.org>
>>>>>>>>>> Sent: Monday, April 11, 2016 10:03:52 AM
>>>>>>>>>> Subject: Re: [Bioc-devel] import except on Window Machine
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Dear Julie,
>>>>>>>>>> Are you using roxigen2 to edit NAMESPACE file?
>>>>>>>>>> Are you using R 3.4?
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> In my case, When I used R 3.3 I get this error:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ==> R CMD INSTALL --no-multiarch --with-keep.source bioCancer
>>>>>>>>>>
>>>>>>>>>> * installing to library
>>>>>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library¹
>>>>>>>>>> * installing *source* package ŒbioCancer¹ ...
>>>>>>>>>> ** R
>>>>>>>>>> ** inst
>>>>>>>>>> ** preparing package for lazy loading
>>>>>>>>>> Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck =
>>>>>>>>>
>>>>>>>>> vI[[i]])
>>>>>>>>>>
>>>>>>>>>> :
>>>>>>>>>>   there is no package called Œc("dataTableOutput",
>>>>>>>
>>>>>>> "renderDataTable")¹
>>>>>>>>>>
>>>>>>>>>> ERROR: lazy loading failed for package ŒbioCancer¹
>>>>>>>>>> * removing
>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library/bioCanc
>>>>>>> er¹
>>>>>>>>>>
>>>>>>>>>> * restoring previous
>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Œ/Library/Frameworks/R.framework/Versions/3.3/Resources/library/bioCanc
>>>>>>> er¹
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Exited with status 1
>>>>>>>>>>
>>>>>>>>>> When I used R 3.4, I get :
>>>>>>>>>>
>>>>>>>>>> unfortunately,
>>>>>>>>>>
>>>>>>>>>> Bioconductor version 3.3 (BiocInstaller 1.21.4), ?biocLite for
>>>>>>>
>>>>>>> help
>>>>>>>>>>
>>>>>>>>>> Bioconductor does not yet support R version 3.4.0
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Apr 11, 2016 at 5:30 PM, Zhu, Lihua (Julie) <
>>>>>>>>>
>>>>>>>>> Julie.Zhu at umassmed.edu>
>>>>>>>>>>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Thanks, Dan!
>>>>>>>>>>>
>>>>>>>>>>> Best,
>>>>>>>>>>>
>>>>>>>>>>> Julie
>>>>>>>>>>>
>>>>>>>>>>> On 4/11/16 12:22 PM, "Dan Tenenbaum" <dtenenba at fredhutch.org>
>>>>>>>
>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> The windows machine is still running an older version of R
>>>>>>>
>>>>>>> that does
>>>>>>>>>
>>>>>>>>> not
>>>>>>>>>>>>
>>>>>>>>>>>> support this NAMESPACE syntax. I will update it this week.
>>>>>>>>>>>> Dan
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ----- Original Message -----
>>>>>>>>>>>>>
>>>>>>>>>>>>> From: "Lihua Zhu" <Julie.Zhu at umassmed.edu>
>>>>>>>>>>>>> To: "bioc-devel" <bioc-devel at r-project.org>
>>>>>>>>>>>>> Cc: "Michael Lawrence" <lawrence.michael at gene.com>
>>>>>>>>>>>>> Sent: Monday, April 11, 2016 9:18:31 AM
>>>>>>>>>>>>> Subject: [Bioc-devel] import except on Window Machine
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Michael,
>>>>>>>>>>>>>
>>>>>>>>>>>>> For some reason,  adding except clause in import in the
>>>>>>>
>>>>>>> NAMESPACE
>>>>>>>>>
>>>>>>>>> file
>>>>>>>>>>>>>
>>>>>>>>>>>>> gives
>>>>>>>>>>>>> error on window server, although it runs fine on Linux and
>>>>>>>
>>>>>>> Mac OS
>>>>>>> X.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__bioconductor.org_ch
>>>>>>> ec
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> kResults_devel_bioc-2DLATEST_CRISPRseek_moscato2-2Dbuildsrc.html&d=BQ
>>>>>>>>> ICaQ
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> &c=WJBj9sUF1mbpVIAf3biu3CPHX4MeRjY_w4DerPlOmhQ&r=3IbW-yoIQpGZOKgd4i2b
>>>>>>>>> gmPH
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> hwHHF5gJMlij5cC5bLU&m=t9rR8WHE_O0PrI0B-0ySt37UGJMdDhnwk0JFoVzS5Cw&s=l
>>>>>>>>> EJWy
>>>>>>>>>>>>>
>>>>>>>>>>>>> zN3zY_O2V1X3QmOZcPD25KidcjhIQMAky52xsA&e=
>>>>>>>>>>>>>
>>>>>>>>>>>>> Here is the line that gives error.
>>>>>>>>>>>>> import(S4Vectors, except=c(fold, values))
>>>>>>>>>>>>>
>>>>>>>>>>>>> Did I miss something? Thank!
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Julie
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>       [[alternative HTML version deleted]]
>>>>>>>>>>>>>
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> Bioc-devel at r-project.org mailing list
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailm
>>>>>>> an
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> _listinfo_bioc-2Ddevel&d=BQICaQ&c=WJBj9sUF1mbpVIAf3biu3CPHX4MeRjY_w4D
>>>>>>>>> erPl
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> OmhQ&r=3IbW-yoIQpGZOKgd4i2bgmPHhwHHF5gJMlij5cC5bLU&m=t9rR8WHE_O0PrI0B
>>>>>>>>> -0yS
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> t37UGJMdDhnwk0JFoVzS5Cw&s=3ZMFBJ4XMwlGXkfXcB5spcBnnzqBDeqk05sf_TSi88g
>>>>>>>>> &e=
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Bioc-devel at r-project.org mailing list
>>>>>>>>>>>
>>>>>>>
>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailm
>>>>>>>
>>>>>>> an_listinfo_bioc-2Ddevel&d=BQIFaQ&c=WJBj9sUF1mbpVIAf3biu3CPHX4MeRjY_w4D
>>>>>>>
>>>>>>> erPlOmhQ&r=3IbW-yoIQpGZOKgd4i2bgmPHhwHHF5gJMlij5cC5bLU&m=p3WrsvoaEWYRGX
>>>>>>>
>>>>>>> 1hHvBYdHyfl3qSnDlhimrlUmhWc78&s=3y16NmxUwgAm1KDxESsjtgLdg1qSZ5EWMfbHqPx
>>>>>>> x7Go&e=
>>>
>>>
>>
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages at fredhutch.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319



More information about the Bioc-devel mailing list