sleuth icon indicating copy to clipboard operation
sleuth copied to clipboard

Unstated namespace dependency on data.table::head

Open andrewrech opened this issue 7 years ago • 11 comments

https://github.com/pachterlab/sleuth/blob/2cbb28749875eaf7dcafb30f9a795313c481fcb1/R/sleuth.R#L800

Error: package or namespace load failed for ‘immune.ml’: object 'head' not found whilst loading namespace 'sleuth' Execution halted

  • checking whether the namespace can be loaded with stated dependencies ... WARNING Error: object 'head' not found whilst loading namespace 'sleuth' Execution halted

A namespace must be able to be loaded with just the base namespace loaded: otherwise if the namespace gets loaded by a saved object, the session will be unable to start.

Thanks

andrewrech avatar Aug 26 '17 00:08 andrewrech

Hi @andrewrech,

Sorry for delay in responding. Are you still experiencing this issue? Could you describe more about what you are doing, as I have never seen this before in any of the times that I used sleuth within R?

warrenmcg avatar Sep 20 '17 13:09 warrenmcg

Yes I am. Thank you. You need you specify the namespace dependency for head. I am depending on sleuth in an R package: data.table::head

andrewrech avatar Sep 23 '17 18:09 andrewrech

* checking whether the namespace can be loaded with stated dependencies ... WARNING
Error: object 'head' not found whilst loading namespace 'sleuth'
Execution halted

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.

andrewrech avatar Sep 24 '17 11:09 andrewrech

Hi @andrewrech, I discovered that there was an API error. The method is supposed to return a data.frame but was instead a dplyr object. Once this API error is corrected, there will not be any need to update the namespace, as head for data frames is built-in. This mistake will be fixed in the upcoming release. I'm submitting a pull request with miscellaneous changes today.

warrenmcg avatar Oct 23 '17 17:10 warrenmcg

Thanks! @warrenmcg

andrewrech avatar Oct 23 '17 17:10 andrewrech

ugh. this is a really annoying bug. thank you both, @andrewrech @warrenmcg!

this fix is now in the development version and will be in the next release.

pimentel avatar Nov 14 '17 05:11 pimentel

@pimentel sorry to bring this up again...still broken on HEAD :-)

─  checking whether the package can be loaded with stated dependencies ...Error: package or namespace load failed for ‘<Andrew's package>’: (3.3s)
    object 'head' not found whilst loading namespace 'sleuth'
   Execution halted

   It looks like this package (or one of its dependent packages) has an
   unstated dependence on a standard package.  All dependencies must be
   declared in DESCRIPTION.
   See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
   manual.

This is clearly exported in your NAMESPACE...I don't get it

andrewrech avatar Feb 24 '19 00:02 andrewrech

Well, it's probable that the same issue is happening: a data.table or dplyr object is being manipulated using head and so the checks is complaining that the specific version of head isn't declared. I'm not sure how quickly I can get to this, but I'll report back as soon as I can.

warrenmcg avatar Feb 24 '19 00:02 warrenmcg

Hmm, well, is devtools::check actually aware of this? It's not running any code so how could this type checking happen?

I just forked sleuth and exported head <- utils::head so my package builds...perhaps we should collectively stop wasting time in the bowels of R CMD check. My issue is solved, feel free to close.

andrewrech avatar Feb 24 '19 00:02 andrewrech

Hmm, actually you maybe just need to prefix this

https://github.com/pachterlab/sleuth/blob/24ca2859f13d1eac588d6dd2ac90bf860b4fe07e/R/sleuth.R#L1091

andrewrech avatar Feb 24 '19 01:02 andrewrech

My understanding is that this function should be returning a data.frame, but the error indicates to me that it is returning a data.table instead, and that is what is tripping R CMD check up.

This unexpected type issue was the exact issue that happened before.

Suggestion: I can't do this myself right now, but try switching adf to as_df at the line below, and see if that works?

https://github.com/pachterlab/sleuth/blob/24ca2859f13d1eac588d6dd2ac90bf860b4fe07e/R/sleuth.R#L1119

warrenmcg avatar Feb 24 '19 01:02 warrenmcg