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

eplusr error on upgrade data.table #4612

Closed
mattdowle opened this issue Jul 17, 2020 · 12 comments · Fixed by #4622
Closed

eplusr error on upgrade data.table #4612

mattdowle opened this issue Jul 17, 2020 · 12 comments · Fixed by #4622
Assignees
Milestone

Comments

@mattdowle
Copy link
Member

mattdowle commented Jul 17, 2020

eplusr_0.12.0.tar.gz
./eplusr.Rcheck/00check.log:* using log directory ‘/home/mdowle/build/revdeplib/eplusr.Rcheck’
./eplusr.Rcheck/00check.log:* using R Under development (unstable) (2020-07-14 r78854)
./eplusr.Rcheck/00check.log:* using platform: x86_64-pc-linux-gnu (64-bit)
./eplusr.Rcheck/00check.log:* using session charset: UTF-8
./eplusr.Rcheck/00check.log:* checking for file ‘eplusr/DESCRIPTION’ ... OK
./eplusr.Rcheck/00check.log:* this is package ‘eplusr’ version ‘0.12.0’
./eplusr.Rcheck/00check.log:* package encoding: UTF-8
./eplusr.Rcheck/00check.log:* checking package namespace information ... OK
./eplusr.Rcheck/00check.log:* checking package dependencies ... OK
./eplusr.Rcheck/00check.log:* checking if this is a source package ... OK
./eplusr.Rcheck/00check.log:* checking if there is a namespace ... OK
./eplusr.Rcheck/00check.log:* checking for executable files ... OK
./eplusr.Rcheck/00check.log:* checking for hidden files and directories ... OK
./eplusr.Rcheck/00check.log:* checking for portable file names ... OK
./eplusr.Rcheck/00check.log:* checking for sufficient/correct file permissions ... OK
./eplusr.Rcheck/00check.log:* checking whether package ‘eplusr’ can be installed ... OK
./eplusr.Rcheck/00check.log:* checking installed package size ... OK
./eplusr.Rcheck/00check.log:* checking package directory ... OK
./eplusr.Rcheck/00check.log:* checking ‘build’ directory ... OK
./eplusr.Rcheck/00check.log:* checking DESCRIPTION meta-information ... OK
./eplusr.Rcheck/00check.log:* checking top-level files ... OK
./eplusr.Rcheck/00check.log:* checking for left-over files ... OK
./eplusr.Rcheck/00check.log:* checking index information ... OK
./eplusr.Rcheck/00check.log:* checking package subdirectories ... OK
./eplusr.Rcheck/00check.log:* checking R files for non-ASCII characters ... OK
./eplusr.Rcheck/00check.log:* checking R files for syntax errors ... OK
./eplusr.Rcheck/00check.log:* checking whether the package can be loaded ... OK
./eplusr.Rcheck/00check.log:* checking whether the package can be loaded with stated dependencies ... OK
./eplusr.Rcheck/00check.log:* checking whether the package can be unloaded cleanly ... OK
./eplusr.Rcheck/00check.log:* checking whether the namespace can be loaded with stated dependencies ... OK
./eplusr.Rcheck/00check.log:* checking whether the namespace can be unloaded cleanly ... OK
./eplusr.Rcheck/00check.log:* checking loading without being on the library search path ... OK
./eplusr.Rcheck/00check.log:* checking dependencies in R code ... OK
./eplusr.Rcheck/00check.log:* checking S3 generic/method consistency ... OK
./eplusr.Rcheck/00check.log:* checking replacement functions ... OK
./eplusr.Rcheck/00check.log:* checking foreign function calls ... OK
./eplusr.Rcheck/00check.log:* checking R code for possible problems ... OK
./eplusr.Rcheck/00check.log:* checking Rd files ... OK
./eplusr.Rcheck/00check.log:* checking Rd metadata ... OK
./eplusr.Rcheck/00check.log:* checking Rd cross-references ... OK
./eplusr.Rcheck/00check.log:* checking for missing documentation entries ... OK
./eplusr.Rcheck/00check.log:* checking for code/documentation mismatches ... OK
./eplusr.Rcheck/00check.log:* checking Rd \usage sections ... OK
./eplusr.Rcheck/00check.log:* checking Rd contents ... OK
./eplusr.Rcheck/00check.log:* checking for unstated dependencies in examples ... OK
./eplusr.Rcheck/00check.log:* checking R/sysdata.rda ... OK
./eplusr.Rcheck/00check.log:* checking installed files from ‘inst/doc’ ... OK
./eplusr.Rcheck/00check.log:* checking files in ‘vignettes’ ... OK
./eplusr.Rcheck/00check.log:* checking examples ... OK
./eplusr.Rcheck/00check.log:* checking for unstated dependencies in ‘tests’ ... OK
./eplusr.Rcheck/00check.log:* checking tests ... ERROR
./eplusr.Rcheck/00check.log:  Running ‘testthat.R’
./eplusr.Rcheck/00check.log:Running the tests in ‘tests/testthat.R’ failed.
./eplusr.Rcheck/00check.log:Last 13 lines of output:
./eplusr.Rcheck/00check.log:  trying URL 'https://raw.githubusercontent.com/NREL/EnergyPlus/v9.2.0/idd/V8-9-0-Energy%2B.idd'
./eplusr.Rcheck/00check.log:  Content type 'text/plain; charset=utf-8' length 4390209 bytes (4.2 MB)
./eplusr.Rcheck/00check.log:  ==================================================
./eplusr.Rcheck/00check.log:  downloaded 4.2 MB
./eplusr.Rcheck/00check.log:  
./eplusr.Rcheck/00check.log:  ══ testthat results  ═══════════════════════════════════════════════════════════
./eplusr.Rcheck/00check.log:  [ OK: 1103 | SKIPPED: 11 | WARNINGS: 0 | FAILED: 5 ]
./eplusr.Rcheck/00check.log:  1. Error: table (@test_impl-idf.R#314) 
./eplusr.Rcheck/00check.log:  2. Error: Set (@test_impl-idf.R#773) 
./eplusr.Rcheck/00check.log:  3. Failure: Update (@test_impl-idf.R#947) 
./eplusr.Rcheck/00check.log:  4. Failure: Update (@test_impl-idf.R#950) 
./eplusr.Rcheck/00check.log:  5. Error: Update (@test_impl-idf.R#955) 
./eplusr.Rcheck/00check.log:  
./eplusr.Rcheck/00check.log:  Error: testthat unit tests failed
./eplusr.Rcheck/00check.log:  Execution halted
./eplusr.Rcheck/00check.log:* checking for unstated dependencies in vignettes ... OK
./eplusr.Rcheck/00check.log:* checking package vignettes in ‘inst/doc’ ... OK
./eplusr.Rcheck/00check.log:* checking running R code from vignettes ... NONE
./eplusr.Rcheck/00check.log:  ‘eplusr.Rmd’ using ‘UTF-8’... OK
./eplusr.Rcheck/00check.log:* checking re-building of vignette outputs ... WARNING
./eplusr.Rcheck/00check.log:Error(s) in re-building vignettes:
./eplusr.Rcheck/00check.log:  ...
./eplusr.Rcheck/00check.log:--- re-building ‘eplusr.Rmd’ using rmarkdown
./eplusr.Rcheck/00check.log:trying URL 'https://github.com/NREL/EnergyPlus/releases/download/v8.8.0/EnergyPlus-8.8.0-7c3bbe4830-Linux-x86_64.tar.gz'
./eplusr.Rcheck/00check.log:Content type 'application/octet-stream' length 101420148 bytes (96.7 MB)
./eplusr.Rcheck/00check.log:==================================================
./eplusr.Rcheck/00check.log:downloaded 96.7 MB
./eplusr.Rcheck/00check.log:Quitting from lines 884-885 (eplusr.Rmd) 
./eplusr.Rcheck/00check.log:Error: processing vignette 'eplusr.Rmd' failed with diagnostics:
./eplusr.Rcheck/00check.log:object 'field' not found
./eplusr.Rcheck/00check.log:--- failed re-building ‘eplusr.Rmd’
./eplusr.Rcheck/00check.log:SUMMARY: processing the following file failed:
./eplusr.Rcheck/00check.log:  ‘eplusr.Rmd’
./eplusr.Rcheck/00check.log:Error: Vignette re-building failed.
./eplusr.Rcheck/00check.log:Execution halted
./eplusr.Rcheck/00check.log:* checking PDF version of manual ... OK
./eplusr.Rcheck/00check.log:* DONE
./eplusr.Rcheck/00check.log:Status: 1 ERROR, 1 WARNING
@mattdowle mattdowle added this to the 1.12.9 milestone Jul 17, 2020
@mattdowle mattdowle mentioned this issue Jul 17, 2020
29 tasks
@mattdowle mattdowle changed the title eplusr error eplusr error on upgrade data.table Jul 17, 2020
@MichaelChirico MichaelChirico self-assigned this Jul 18, 2020
@MichaelChirico
Copy link
Member

MichaelChirico commented Jul 18, 2020

This is a regression. Still haven't quite nailed down an MRE but it's do do with using a variable in j from the same environment, which is causing the eval used for #4159 to fail.

@hongyuanjia
Copy link
Contributor

hongyuanjia commented Jul 19, 2020

I am the author of eplusr package. Maybe I can help to provide a MRE here. But I did not know how to install the version that cause this error. Can I directly install the dev version of data.table via remote::install_github("Rdatatable/data.table")?

@eddelbuettel
Copy link
Contributor

eddelbuettel commented Jul 19, 2020

@hongyuanjia That is correct. The release candidate version in current development is in the main branch, and with that install_github() call you will get it.

@MichaelChirico
Copy link
Member

MichaelChirico commented Jul 19, 2020

Thanks @hongyuanjia , yes the latest dev reproduced the error for me. However it stopped reproducing as the eplusr vignette stopped compiling. I think maybe I was pinging GitHub to download the EPlus binary a few too many times

@eddelbuettel
Copy link
Contributor

eddelbuettel commented Jul 19, 2020

I think maybe I was pinging GitHub to download the EPlus binary a few too many times

I can recommend registering a GITHUB_PAT and setting it as an environment variable.

@hongyuanjia
Copy link
Contributor

hongyuanjia commented Jul 19, 2020

Below is a MRE. Seems like a scoping issue:

library(data.table)

dt <- data.table(id = c(1, 1, 2), value = c("a", "b", "c"))

fun <- function (dt, tag = c("A", "B")) {
    dt[, var := tag[[.GRP]], by = "id"]
}

fun(dt)
#> Error in eval(call("is.atomic", jsub[[2L]]), envir = x): object 'tag' not found

Created on 2020-07-20 by the reprex package (v0.3.0)

@hongyuanjia
Copy link
Contributor

hongyuanjia commented Jul 19, 2020

Interesting. Inside [.data.table, [[ does not work but [ does:

library(data.table)

dt <- data.table(id = c(1, 1, 2), value = c("a", "b", "c"))

fun1 <- function (dt, tag = c("A", "B")) {
    # using "[[" does not work
    dt[, var := tag[[.GRP]], by = "id"]
}

fun1(dt)[]
#> Error in eval(call("is.atomic", jsub[[2L]]), envir = x): object 'tag' not found

fun2 <- function (dt, tag = c("A", "B")) {
    # using "[" works
    dt[, var := tag[.GRP], by = "id"]
}

fun2(dt)[]
#>    id value var
#> 1:  1     a   A
#> 2:  1     b   A
#> 3:  2     c   B

Created on 2020-07-20 by the reprex package (v0.3.0)

@hongyuanjia
Copy link
Contributor

hongyuanjia commented Jul 19, 2020

The error comes from:

(jsub[[1L]] == "[[" && is.name(jsub[[2L]]) && eval(call('is.atomic', jsub[[2L]]), envir = x))) &&

where [.data.table tries to evaluate the name inside the data.table.

@hongyuanjia
Copy link
Contributor

hongyuanjia commented Jul 19, 2020

I can confirm that all errors are caused by this issue. After I temporarily getting workaround on this, all check errors are gone and eplusr can work well with dev version of data.table.

@MichaelChirico
Copy link
Member

MichaelChirico commented Jul 20, 2020

Thanks @hongyuanjia for the MRE. I do think data.table should be able to work without any change on your end in this case. It is a bug introduced by the fix for #4159.

@ColeMiller1
Copy link
Contributor

ColeMiller1 commented Jul 20, 2020

@MichaelChrico I looked into this - it looks like simply adding enclos = parent.frame() within the eval statement fixes the issue. I recompiled and the (great!) MRE no longer errors and there are no tests that fail on our end. Not sure why it works, that should be the default enclosure.

@MichaelChirico
Copy link
Member

MichaelChirico commented Jul 20, 2020

Thanks @ColeMiller1 I had tried that but I only tried it on a non-MRE so it didn't work. Glad it's as easy as that.

eval's default is parent.frame() here, but when that parent.frame() is evaluated, it's within eval. We need it to be parent.frame(), evaluated from within j. I think.

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

Successfully merging a pull request may close this issue.

5 participants