ropensci / taxizedb

Tools for Working with Taxonomic SQL Databases
Other
30 stars 7 forks source link

load_gbif incorrectly claims 'sqlite3 not available' #29

Closed cboettig closed 6 years ago

cboettig commented 6 years ago

I can use SQLite through the usual DBI / dplyr methods, e.g.

sqlite <- DBI::dbConnect(RSQLite::SQLite(), path = "ex.sqlite")
sqlite_src <- dbplyr::src_dbi(sqlite)

but this errors:

 gbif <- db_load_gbif()
checking if SQLite installed...
Error in db_installed("sqlite3") : 
sqlite3 not found on your computer
Install the missing tool(s) and try again

sessionInfo:

devtools::session_info()
Session info ---------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.3 (2017-11-30)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.442)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       UTC                         
 date     2018-03-26                  

Packages -------------------------------------------------------------------------------------------
 package     * version date       source        
 assertthat    0.2.0   2017-04-11 CRAN (R 3.4.3)
 base        * 3.4.3   2018-03-13 local         
 bindr         0.1.1   2018-03-13 CRAN (R 3.4.3)
 bindrcpp      0.2     2017-06-17 CRAN (R 3.4.3)
 bit           1.1-12  2014-04-09 CRAN (R 3.4.3)
 bit64         0.9-7   2017-05-08 CRAN (R 3.4.3)
 blob          1.1.0   2017-06-17 CRAN (R 3.4.3)
 compiler      3.4.3   2018-03-13 local         
 curl          3.1     2017-12-12 CRAN (R 3.4.3)
 datasets    * 3.4.3   2018-03-13 local         
 DBI           0.8     2018-03-02 CRAN (R 3.4.3)
 dbplyr      * 1.2.1   2018-02-19 CRAN (R 3.4.3)
 devtools      1.13.5  2018-02-18 CRAN (R 3.4.3)
 digest        0.6.15  2018-01-28 CRAN (R 3.4.3)
 dplyr       * 0.7.4   2017-09-28 CRAN (R 3.4.3)
 glue          1.2.0   2017-10-29 CRAN (R 3.4.3)
 graphics    * 3.4.3   2018-03-13 local         
 grDevices   * 3.4.3   2018-03-13 local         
 hoardr        0.2.0   2017-05-10 CRAN (R 3.4.3)
 magrittr      1.5     2014-11-22 CRAN (R 3.4.3)
 memoise       1.1.0   2017-04-21 CRAN (R 3.4.3)
 methods     * 3.4.3   2018-03-13 local         
 pillar        1.2.1   2018-02-27 CRAN (R 3.4.3)
 pkgconfig     2.0.1   2017-03-21 CRAN (R 3.4.3)
 R6            2.2.2   2017-06-17 CRAN (R 3.4.3)
 rappdirs      0.3.1   2016-03-28 CRAN (R 3.4.3)
 Rcpp          0.12.16 2018-03-13 CRAN (R 3.4.3)
 rlang         0.2.0   2018-02-20 CRAN (R 3.4.3)
 RMySQL        0.10.14 2018-02-26 CRAN (R 3.4.3)
 RPostgreSQL   0.6-2   2017-06-24 CRAN (R 3.4.3)
 RSQLite       2.0     2017-06-19 CRAN (R 3.4.3)
 rstudioapi    0.7     2017-09-07 CRAN (R 3.4.3)
 stats       * 3.4.3   2018-03-13 local         
 taxizedb    * 0.1.4   2017-06-20 CRAN (R 3.4.3)
 tibble        1.4.2   2018-01-22 CRAN (R 3.4.3)
 tools         3.4.3   2018-03-13 local         
 utils       * 3.4.3   2018-03-13 local         
 withr         2.1.2   2018-03-15 CRAN (R 3.4.3)
 yaml          2.1.18  2018-03-08 CRAN (R 3.4.3)
cboettig commented 6 years ago

ah, sorry, two separate things here. looks like taxizedb is trying to call the command-line client directly, rather than use a DBI connection. Seems like this could be avoided? But maybe is necessary for import? Needing a bunch of command-line client utilities installed definitely makes things more cumbersome, would be nice to see if we can work around this? I will dig more.

cboettig commented 6 years ago

So I think the db_load_gbif() check should just be dropped, or should check for the DBI support. The sqlite3 client is never actually needed to connect, so this check is a bit misleading.

(Same for NCBI)

sckott commented 6 years ago

hmm, so the order of events for any one data source is (here for gbif):

  1. db_download_gbif
  2. db_load_gbif
  3. src_gbif

in step 3 we do https://github.com/ropensci/taxizedb/blob/master/R/src.R#L46-L50

so maybe we don't need the user to have sqlite installed? true?

@arendsee does the user need sqlite installed on their machine to do the work in db_download_ncbi ?

cboettig commented 6 years ago

You need SQLite support, eg libsqlite3-dev on Debian, but not the client, sqlite3, which is what the function currently checks for On Mon, Mar 26, 2018 at 10:20 PM Scott Chamberlain notifications@github.com wrote:

hmm, so the order of events for any one data source is (here for gbif):

  1. db_download_gbif
  2. db_load_gbif
  3. src_gbif

in step 3 we do https://github.com/ropensci/taxizedb/blob/master/R/src.R#L46-L50

so maybe we don't need the user to have sqlite installed? true?

@arendsee https://github.com/arendsee does the user need sqlite installed on their machine to do the work in db_download_ncbi ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropensci/taxizedb/issues/29#issuecomment-376400402, or mute the thread https://github.com/notifications/unsubscribe-auth/AANleh9VROAq02_n7sF-l_9rG5FtD8jEks5ticw2gaJpZM4S7042 .

--

http://carlboettiger.info

sckott commented 6 years ago

ah okay. hmm, the description for the RSqlite pkg says it embeds sqlite, but maybe not?

cboettig commented 6 years ago

Sorry, yeah, I think RSQLite can install without the dev libs installed. Anyway, db_load_gbif() shouldn't check for the presence of the command-line program sqlite3 since it is not needed for src_gbif() to run successfully. It isn't needed for ncbi functions either, all the SQLite calls are made directly through RSQLite.

(e.g. so currently I get the error sqlite3 not available from the db_load_gbif() even though RSQLite is installed and all the functions work just fine; just I don't have the command-line client sqlite3 available in my PATH).

sckott commented 6 years ago

okay, i think we should remove the sqlite3 check