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

Warning in importBugSigDB() when updating a previously cached version (windows-only) #32

Closed
cmirzayi opened this issue Sep 21, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@cmirzayi
Copy link

Importing a new version of the data fails when a cached version exists due to importBugSigDB() failing to remove the previously cached version of the dataset. This error occurs on Windows (but appears to not occur on Linux or Mac).

Reproducible example

Run this twice on Windows and you will see the error message the second time:

library(bugsigdbr)
dat <- importBugSigDB(version = "devel")
Warning message:
In file.remove(temppath) :
  cannot remove file 'C:\Users\cmirz\AppData\Local/R/cache/R/bugsigdbr\file73f83e0878', reason 'Permission denied'
## check the error trace
> traceback()
6: stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
5: stopifnot(all(rids %in% bfcrid(x)))
4: BiocFileCache::bfcremove(bfc, qgsc$rid)
3: BiocFileCache::bfcremove(bfc, qgsc$rid) at cache.R#19
2: .cacheResource(rname, url, download = FALSE, ext = ".rds") at bugsigdb.R#44
1: importBugSigDB(version = "devel", cache = FALSE)

R session information

options(width = 120)
sessioninfo::session_info()

- Session info -------------------------------------------------------------------------------------------------------
 setting  value
 version  R version 4.1.2 (2021-11-01)
 os       Windows 10 x64 (build 19044)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.1252
 ctype    English_United States.1252
 tz       America/New_York
 date     2022-09-21
 rstudio  2022.07.1+554 Spotted Wakerobin (desktop)
 pandoc   NA

- Packages -----------------------------------------------------------------------------------------------------------
 !  package       * version date (UTC) lib source
    assertthat      0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
    BiocFileCache   2.2.1   2022-01-23 [1] Bioconductor
    bit             4.0.4   2020-08-04 [1] CRAN (R 4.1.0)
    bit64           4.0.5   2020-08-30 [1] CRAN (R 4.1.0)
    blob            1.2.3   2022-04-10 [1] CRAN (R 4.1.3)
    brio            1.1.3   2021-11-30 [1] CRAN (R 4.1.2)
 VP bugsigdbr     * 1.3.1   2022-01-24 [?] Github (waldronlab/bugsigdbr@4d2f9b2) (on disk 1.1.8)
    cachem          1.0.6   2021-08-19 [1] CRAN (R 4.1.1)
    callr           3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
    cli             3.2.0   2022-02-14 [1] CRAN (R 4.1.3)
    crayon          1.5.1   2022-03-26 [1] CRAN (R 4.1.3)
    curl            4.3.2   2021-06-23 [1] CRAN (R 4.1.0)
    DBI             1.1.2   2021-12-20 [1] CRAN (R 4.1.2)
    dbplyr          2.1.1   2021-04-06 [1] CRAN (R 4.1.0)
    desc            1.4.1   2022-03-06 [1] CRAN (R 4.1.3)
    devtools        2.4.3   2021-11-30 [1] CRAN (R 4.1.2)
    dplyr           1.0.8   2022-02-08 [1] CRAN (R 4.1.3)
    ellipsis        0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
    fansi           1.0.3   2022-03-24 [1] CRAN (R 4.1.3)
    fastmap         1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
    filelock        1.0.2   2018-10-05 [1] CRAN (R 4.1.0)
    fs              1.5.2   2021-12-08 [1] CRAN (R 4.1.2)
    generics        0.1.2   2022-01-31 [1] CRAN (R 4.1.2)
    glue            1.6.2   2022-02-24 [1] CRAN (R 4.1.3)
    httr            1.4.2   2020-07-20 [1] CRAN (R 4.1.0)
    lifecycle       1.0.1   2021-09-24 [1] CRAN (R 4.1.2)
    magrittr        2.0.3   2022-03-30 [1] CRAN (R 4.1.3)
    memoise         2.0.1   2021-11-26 [1] CRAN (R 4.1.2)
    pillar          1.7.0   2022-02-01 [1] CRAN (R 4.1.2)
    pkgbuild        1.3.1   2021-12-20 [1] CRAN (R 4.1.2)
    pkgconfig       2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
    pkgload         1.2.4   2021-11-30 [1] CRAN (R 4.1.2)
    prettyunits     1.1.1   2020-01-24 [1] CRAN (R 4.1.0)
    processx        3.5.3   2022-03-25 [1] CRAN (R 4.1.3)
    ps              1.7.0   2022-04-23 [1] CRAN (R 4.1.3)
    purrr           0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
    R6              2.5.1   2021-08-19 [1] CRAN (R 4.1.0)
    rappdirs        0.3.3   2021-01-31 [1] CRAN (R 4.1.0)
    Rcpp            1.0.8.3 2022-03-17 [1] CRAN (R 4.1.3)
    remotes         2.4.2   2021-11-30 [1] CRAN (R 4.1.3)
    rlang           1.0.2   2022-03-04 [1] CRAN (R 4.1.3)
    rprojroot       2.0.3   2022-04-02 [1] CRAN (R 4.1.3)
    RSQLite         2.2.12  2022-04-02 [1] CRAN (R 4.1.3)
    rstudioapi      0.13    2020-11-12 [1] CRAN (R 4.1.0)
    sessioninfo     1.2.2   2021-12-06 [1] CRAN (R 4.1.2)
    testthat      * 3.1.3   2022-03-29 [1] CRAN (R 4.1.3)
    tibble          3.1.6   2021-11-07 [1] CRAN (R 4.1.2)
    tidyselect      1.1.2   2022-02-21 [1] CRAN (R 4.1.3)
    tzdb            0.3.0   2022-03-28 [1] CRAN (R 4.1.3)
    usethis         2.1.5   2021-12-09 [1] CRAN (R 4.1.2)
    utf8            1.2.2   2021-07-24 [1] CRAN (R 4.1.0)
    vctrs           0.4.1   2022-04-13 [1] CRAN (R 4.1.3)
    vroom           1.5.7   2021-11-30 [1] CRAN (R 4.1.2)
    withr           2.5.0   2022-03-03 [1] CRAN (R 4.1.3)

 [1] C:/Users/cmirz/Documents/R/win-library/4.1
 [2] C:/Program Files/R/R-4.1.2/library

 V -- Loaded and on-disk version mismatch.
 P -- Loaded and on-disk path mismatch.

----------------------------------------------------------------------------------------------------------------------
@jwokaty jwokaty added the bug Something isn't working label Sep 21, 2022
@lgeistlinger
Copy link
Contributor

Looks like there is something funny going on with the file path mixing forward slashes and backslashes. Maybe some use of paste instead of file.path. I'll take a look the next time I have access to a windows machine (likely tomorrow).

@cmirzayi
Copy link
Author

Oh yep that might be right. It looks like if you replace the backslashes with double backslashes that finds the file

> file.exists("C:\Users\cmirz\AppData\Local/R/cache/R/bugsigdbr\file73f83e0878")
[1] FALSE
> file.exists("C:\\Users\\cmirz\\AppData\\Local/R/cache/R/bugsigdbr\\file73f83e0878")
[1] TRUE

@lgeistlinger lgeistlinger changed the title [BUG] importBugSigDB() fails because unable to remove previously cached version Warning in importBugSigDB() when updating a previously cached version (windows-only) Feb 5, 2023
@lgeistlinger
Copy link
Contributor

Sorry for the long wait. Finally got access to a windows machine. I couldn't reproduce the issue as described. I did see the reported warning message (note: a warning, not an error) when using importBugSigDB with cache = FALSE though.

The problem was that BiocFileCache::bfcdownload tried to delete a temporary file that was read with vroom::vroom, which triggered a warning that seems to appear only on windows (as previously described in tidyverse/vroom#177). Note that the functionality of importBugSigDB was never compromised, as calling importBugSigDB with cache = FALSE did overwrite your local copy in your cache, but failed to remove a temporary file at clean-up. This is now resolved in 1b86edd.

Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants