ropensci / taxadb

:package: Taxonomic Database
https://docs.ropensci.org/taxadb
Other
43 stars 13 forks source link

Error message when calling filter_by #83

Closed juanchocarvajal closed 3 years ago

juanchocarvajal commented 3 years ago

Dear @cboettig and other taxadb developers 👋

I've started getting a error message when using the filter_by function. The following is a reproducible example:

get_gbif <- as.data.frame(taxadb::filter_by(spp_BioT, by= "scientificName", provider = "gbif"))
#> Error in initialize(value, ...): duckdb_startup_R: Failed to open database

Created on 2021-03-04 by the reprex package (v1.0.0)

Session info ``` r sessioninfo::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 4.0.4 (2021-02-15) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Europe/Berlin #> date 2021-03-04 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> arkdb 0.0.8 2020-11-04 [1] CRAN (R 4.0.3) #> askpass 1.1 2019-01-13 [1] CRAN (R 4.0.3) #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.3) #> bit 4.0.4 2020-08-04 [1] CRAN (R 4.0.3) #> bit64 4.0.5 2020-08-30 [1] CRAN (R 4.0.3) #> blob 1.2.1 2020-01-20 [1] CRAN (R 4.0.3) #> cachem 1.0.4 2021-02-13 [1] CRAN (R 4.0.4) #> cli 2.3.1 2021-02-23 [1] CRAN (R 4.0.4) #> contentid 0.0.9 2021-01-15 [1] CRAN (R 4.0.4) #> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.4) #> curl 4.3 2019-12-02 [1] CRAN (R 4.0.3) #> DBI 1.1.1 2021-01-15 [1] CRAN (R 4.0.4) #> dbplyr 2.1.0 2021-02-03 [1] CRAN (R 4.0.4) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3) #> dplyr 1.0.4 2021-02-02 [1] CRAN (R 4.0.4) #> duckdb 0.2.4 2021-02-02 [1] CRAN (R 4.0.4) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.3) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.3) #> fansi 0.4.2 2021-01-15 [1] Github (cran/fansi@39c8fbb) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.0.4) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.3) #> generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.3) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.3) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.3) #> hms 1.0.0 2021-01-13 [1] CRAN (R 4.0.4) #> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.4) #> httr 1.4.2 2020-07-20 [1] CRAN (R 4.0.3) #> jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.0.3) #> knitr 1.31 2021-01-27 [1] CRAN (R 4.0.4) #> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.4) #> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.3) #> memoise 2.0.0 2021-01-26 [1] CRAN (R 4.0.4) #> openssl 1.4.3 2020-09-18 [1] CRAN (R 4.0.3) #> pillar 1.5.0 2021-02-22 [1] CRAN (R 4.0.4) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.3) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.3) #> progress 1.2.2 2019-05-16 [1] CRAN (R 4.0.3) #> ps 1.6.0 2021-02-28 [1] CRAN (R 4.0.4) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.3) #> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.0.3) #> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.0.3) #> R.utils 2.10.1 2020-08-26 [1] CRAN (R 4.0.3) #> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.3) #> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.0.4) #> Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.4) #> readr 1.4.0 2020-10-05 [1] CRAN (R 4.0.3) #> reprex 1.0.0 2021-01-27 [1] CRAN (R 4.0.4) #> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.3) #> rmarkdown 2.7 2021-02-19 [1] CRAN (R 4.0.4) #> RSQLite 2.2.3 2021-01-24 [1] CRAN (R 4.0.4) #> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.3) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.3) #> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.3) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.3) #> taxadb 0.1.2 2021-03-04 [1] Github (ropensci/taxadb@b3991e9) #> tibble 3.1.0 2021-02-25 [1] CRAN (R 4.0.3) #> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.3) #> utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.3) #> vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.3) #> withr 2.4.1 2021-01-26 [1] CRAN (R 4.0.4) #> xfun 0.21 2021-02-10 [1] CRAN (R 4.0.4) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.3) #> #> [1] C:/Users/ro03deda/Documents/R/win-library/4.0 #> [2] C:/Users/ro03deda/Documents/R/R-4.0.4/library ```

which produces the following output:

cboettig commented 3 years ago

@juanchocarvajal thanks for interest in taxadb and the reprex report!

Unfortunately, this is one of those cases even reprex can't ensure is reproducible on another machine. There are at least two common ways to cause this error: either because you may have recently updated your duckdb package (unfortunately duckdb is still in early development and new versions are not backwards compatible), or you have R open in another session that is trying to access the data with a write-access connection to the database. The latter issue we can fix with a patch to taxadb, but the former will be a problem until duckdb hits v1.0 (though at least the next version of duckdb will give a more explicit error message about the version upgrade).

Meanwhile, you can resolve the read-only connection issue on your end simply by restarting any other open R sessions that have loaded taxadb. If that's the issue, all should be well again. Otherwise, if it's the version problem, we need to nuke and rebuild taxadb's database. Just delete the folder shown by taxadb:::taxadb_dir(). You'll then have to wait again when taxadb does the one-time rebuild.

Apologies, we know these weird database gotchas are rather inconvenient! If you're feeling adventurous, @karinorman and I recently released taxalight to CRAN, which is faster, has fewer dependencies, but also fewer functions -- all the filter_ functions are replaced by tl. https://github.com/cboettig/taxalight If you try this, let us know how it goes!