ropensci / rfishbase

R interface to the fishbase.org database
https://docs.ropensci.org/rfishbase
109 stars 40 forks source link

Can't retrieve any table from sealifebase - [Error in error(paste("Some ids failed to resolve")): could not find function "error"] #261

Closed pamdx closed 1 year ago

pamdx commented 1 year ago

Hi and thank you so much for this very useful package!

It looks like I'm facing a bug with the fb_tbl() function.

library(rfishbase)
#> Warning: package 'rfishbase' was built under R version 4.2.2

fb_tbl("synonyms", server = "fishbase")
#> # A tibble: 100,981 × 47
#>    SynCode  SynOC SpecCode SynGenus SynSp…¹ Author  Year Synon…² Taxon…³ Synco…⁴
#>      <int>  <int>    <int> <chr>    <chr>   <chr>  <int>   <int> <chr>     <int>
#>  1  175718 175718        0 Aborich… kailas… Shang…  2019      NA Species      NA
#>  2  175689 175689        0 Aborich… pangen… Shang…  2019      NA Species      NA
#>  3  175203 175203        0 Abyssob… hadrop… Ohash…  2016      NA Species      NA
#>  4  174927 174927        0 Abyssoc… fuscus  Bogda…  2013      NA Species      NA
#>  5  174922 174922        0 Abyssoc… pumilus Bogda…  2013      NA Species      NA
#>  6  176065 176065        0 Acanthe… aceroi  Hasti…  2020      NA Species      NA
#>  7  175976 175976        0 Acantho… scrugg… Carva…  2020      NA Species      NA
#>  8  174812 174812        0 Acantho… lanchi… Herre…  1936      NA Species      NA
#>  9  174792 174792        0 Acanthu… mindor… Herre…  1927      NA Species      NA
#> 10  175470 175470        0 Acantop… bruinen Boyd,…  2018      NA Species      NA
#> # … with 100,971 more rows, 37 more variables: LastEpithet <chr>,
#> #   Comment <chr>, Etymology <chr>, Status <chr>, Valid <int>, ValidTax <int>,
#> #   Synonymy <chr>, SynonymyDetail <chr>, Combination <chr>, OriginalPub <int>,
#> #   Misspelling <int>, MisspellingDetail <chr>, NounApposition <int>,
#> #   Protonym <int>, Basionym <int>, StatusOrder <int>, RankSearch <int>,
#> #   CommentTax <chr>, GSDOriginal <int>, GSDStatus <int>,
#> #   GSDVersionDate <dttm>, GSDExpert <int>, CAS_SPC <int>, CAS_REF_NO <int>, …
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
library(rfishbase)
#> Warning: package 'rfishbase' was built under R version 4.2.2

fb_tbl("synonyms", server = "sealifebase")
#> Warning in .f(.x[[i]], ...): No sources found for hash://
#> sha256/030a3837d4e022248f67cca6bf3ac4bdeae3b35eb5ae73dd4b5756f3618f7068
#> Error in error(paste("Some ids failed to resolve")): could not find function "error"

I'm interested in getting the synonyms table, but I've tried this with other tables and I get the same error code.

I've also tried setting Sys.setenv(FISHBASE_API="sealifebase") along with fb_tbl("synonyms", server = NULL) (as suggested here), that doesn't work either.

Am I doing something wrong? Thanks very much in advance for your help!

Session Info ```r R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22621) Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 LC_MONETARY=English_United Kingdom.utf8 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rfishbase_4.0.0 janitor_2.1.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 [10] ggplot2_3.3.6 tidyverse_1.3.1 loaded via a namespace (and not attached): [1] lubridate_1.8.0 prettyunits_1.1.1 assertthat_0.2.1 utf8_1.2.2 R6_2.5.1 duckdb_0.6.2 cellranger_1.1.0 backports_1.4.1 [9] reprex_2.0.1 httr_1.4.3 pillar_1.8.0 rlang_1.0.2 progress_1.2.2 curl_4.3.2 readxl_1.4.0 rstudioapi_0.13 [17] contentid_0.0.16 bit_4.0.4 munsell_0.5.0 broom_0.8.0 compiler_4.2.0 modelr_0.1.8 pkgconfig_2.0.3 askpass_1.1 [25] openssl_2.0.2 tidyselect_1.1.2 fansi_1.0.3 crayon_1.5.1 tzdb_0.3.0 dbplyr_2.2.0 withr_2.5.0 grid_4.2.0 [33] jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 magrittr_2.0.3 scales_1.2.0 cli_3.3.0 stringi_1.7.6 [41] vroom_1.5.7 cachem_1.0.6 fs_1.5.2 snakecase_0.11.0 xml2_1.3.3 ellipsis_0.3.2 generics_0.1.3 vctrs_0.4.1 [49] tools_4.2.0 bit64_4.0.5 glue_1.6.2 hms_1.1.1 parallel_4.2.0 fastmap_1.1.0 colorspace_2.0-3 rvest_1.0.2 [57] memoise_2.0.1 haven_2.5.0 ```
cboettig commented 1 year ago

apologies for these issues. we have some changes coming with a new release of the data but they are not ready yet! I plan to get to this in early February.

pamdx commented 1 year ago

great! Thanks for the feedback, I'm looking forward to the new release!

cboettig commented 1 year ago

Ok, data updated and new release has been prepared. Can you try now:

remotes::install_github("ropensci/rfishbase")

and test again? Let me know how this goes and I'll try and get this version onto CRAN soon.

On the first use it will import the data and might be a bit slow. In general I think this new release should be faster than the current one once it's got a copy of the data stored locally. As always thanks for the bug reports, super helpful!

cboettig commented 1 year ago

please re-open if this is not resolved in the 4.1.0 release

pamdx commented 1 year ago

Hmmm, something's wrong: whenever I try to use fb_tbl(), I get the R fatal error dialog below. This happens whether I try retrieving data from fishbase or sealifebase.

image

Using reprex() tells me that R cannot find the fb_tbl() function, though sessionInfo() shows that rfishbase_4.1.0 is attached :

fb_tbl("synonyms", server = "fishbase")
#> Error in fb_tbl("synonyms", server = "fishbase"): could not find function "fb_tbl"
Session Info ```r R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22621) Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 LC_MONETARY=English_United Kingdom.utf8 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rfishbase_4.1.0 janitor_2.1.0 forcats_0.5.1 stringr_1.5.0 dplyr_1.1.0 purrr_1.0.1 readr_2.1.4 tidyr_1.2.0 tibble_3.1.8 [10] ggplot2_3.3.6 tidyverse_1.3.1 loaded via a namespace (and not attached): [1] lubridate_1.8.0 ps_1.7.0 prettyunits_1.1.1 assertthat_0.2.1 digest_0.6.29 utf8_1.2.3 R6_2.5.1 cellranger_1.1.0 [9] backports_1.4.1 reprex_2.0.2 evaluate_0.16 httr_1.4.4 highr_0.9 pillar_1.8.1 rlang_1.0.6 progress_1.2.2 [17] readxl_1.4.0 rstudioapi_0.14 callr_3.7.0 R.utils_2.12.0 R.oo_1.25.0 rmarkdown_2.14 styler_1.7.0 munsell_0.5.0 [25] broom_0.8.0 compiler_4.2.0 modelr_0.1.8 xfun_0.31 pkgconfig_2.0.3 clipr_0.8.0 htmltools_0.5.2 tidyselect_1.2.0 [33] fansi_1.0.4 crayon_1.5.2 tzdb_0.3.0 dbplyr_2.3.0 withr_2.5.0 R.methodsS3_1.8.2 grid_4.2.0 jsonlite_1.8.4 [41] gtable_0.3.0 lifecycle_1.0.3 DBI_1.1.3 magrittr_2.0.3 scales_1.2.0 cli_3.6.0 stringi_1.7.12 fs_1.6.1 [49] snakecase_0.11.0 xml2_1.3.3 ellipsis_0.3.2 generics_0.1.3 vctrs_0.5.2 tools_4.2.0 R.cache_0.15.0 glue_1.6.2 [57] hms_1.1.2 processx_3.5.3 fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3 rvest_1.0.2 knitr_1.39 haven_2.5.0 ```
cboettig commented 1 year ago

when using reprex, be sure to include library(rfishbase) command.

cboettig commented 1 year ago

meanwhile I'll see if I can test on Windows, I noticed some issues in the CI testing I couldn't diagnose.

cboettig commented 1 year ago

Okay there appears to be a problem with duckdb's http plugin.

I think this will reproduce the error on Windows:

conn <- DBI::dbConnect(duckdb::duckdb())
DBI::dbExecute(conn, "INSTALL 'httpfs';")
DBI::dbExecute(conn, "LOAD 'httpfs';")
cboettig commented 1 year ago

ok, try once again to reinstall from github, restart your R session, and test again? Sorry for the trouble! I think it should be okay on Windows now :crossed_fingers:

pamdx commented 1 year ago

amazing, it works now! Thank you very much!

library(rfishbase)
fb_tbl("synonyms", server = "sealifebase")
#> # A tibble: 141,374 × 53
#>    SynCode SpecCode SynGe…¹ SynSp…² Author  Year Synon…³ Taxon…⁴ Synco…⁵ LastE…⁶
#>      <int>    <int> <chr>   <chr>   <chr>  <int>   <int> <chr>     <int> <chr>  
#>  1   27871    32307 Aaptol… americ… (Pils…  1916      19 Species      NA americ…
#>  2   27872    32306 Aaptol… brinto… Newma…  1971      19 Species      NA brinto…
#>  3   27873    32308 Aaptol… callis… (Pils…  1911      19 Species      NA callis…
#>  4   27874    32304 Aaptol… leptod… Newma…  1971      19 Species      NA leptod…
#>  5   27875    32305 Aaptol… trider… Newma…  1971      19 Species      NA trider…
#>  6   86299    51720 Aaptos  aaptos  (Schm…  1864      19 Species      NA aaptos 
#>  7  155566   130062 Aaptos  aaptos… Lévi,…  1961   81807 Variety      NA nigra  
#>  8  120162    51720 Aaptos  adriat… Gray,…  1867   75097 Species      NA adriat…
#>  9  198007   165941 Aaptos  bergma… de La…  1950    3477 Species      NA bergma…
#> 10  155567   130062 Aaptos  chromis de La…  1954   81807 Species      NA chromis
#> # … with 141,364 more rows, 43 more variables: Comment <chr>, Etymology <chr>,
#> #   Status <chr>, Valid <int>, ValidTax <int>, Synonymy <chr>,
#> #   SynonymyDetail <chr>, Combination <chr>, OriginalPub <int>,
#> #   Misspelling <int>, MisspellingDetail <chr>, StatusOrder <int>,
#> #   RankSearch <int>, CommentTax <chr>, GSDOriginal <int>, GSDStatus <int>,
#> #   GSDVersionDate <chr>, GSDExpert <int>, CAS_SPC <int>, CAS_REF_NO <int>,
#> #   CoL <chr>, CoL_GSD <chr>, CoL_ID <chr>, ZooBank_ID <int>, TSN <int>, …