duckdb / duckdb-r

The duckdb R package
https://r.duckdb.org/
Other
131 stars 23 forks source link

Failed to download extension #444

Open rafapereirabr opened 1 month ago

rafapereirabr commented 1 month ago

I'm having a small issue when trying to install {duckdb} extensions on my Windows machine. I suspect this is because duckdb is pointing to a http url, instead of a https url. See reprex and R session below.

ps. I had no problem running this code on my personal computer (Windows), but this has been a persistent problem in my computer at the office (also Windows).

reprex

library(DBI)
library(duckdb)
library(tidyverse)

con <- dbConnect(duckdb::duckdb(config=list('allow_unsigned_extensions'='true')))

dbExecute(con,"install httpfs;")
dbExecute(con,"load httpfs;")

Erro: rapi_execute: Failed to run query Error: IO Error: Failed to download extension "httpfs" at URL "http://extensions.duckdb.org/v1.0.0/windows_amd64_rtools/httpfs.duckdb_extension.gz" Extension "httpfs" is an existing extension. (ERROR Connection)

R session

> sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8  LC_CTYPE=Portuguese_Brazil.utf8    LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C                      
[5] LC_TIME=Portuguese_Brazil.utf8    

time zone: America/Sao_Paulo
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.3 forcats_1.0.0   stringr_1.5.1   dplyr_1.1.4     purrr_1.0.2     readr_2.1.5     tidyr_1.3.1     tibble_3.2.1    ggplot2_3.5.1  
[10] tidyverse_2.0.0 duckdb_1.1.0    DBI_1.2.3      

loaded via a namespace (and not attached):
 [1] utf8_1.2.4         generics_0.1.3     class_7.3-22       KernSmooth_2.23-24 stringi_1.8.4      hms_1.1.3          digest_0.6.37      magrittr_2.0.3    
 [9] timechange_0.3.0   evaluate_1.0.0     grid_4.4.1         fastmap_1.2.0      e1071_1.7-16       fansi_1.0.6        scales_1.3.0       cli_3.6.3         
[17] rlang_1.1.4        units_0.8-5        munsell_0.5.1      withr_3.0.1        tools_4.4.1        tzdb_0.4.0         colorspace_2.1-1   curl_5.2.3        
[25] vctrs_0.6.5        R6_2.5.1           proxy_0.4-27       lifecycle_1.0.4    classInt_0.4-10    fs_1.6.4           pkgconfig_2.0.3    pillar_1.9.0      
[33] gtable_0.3.5       glue_1.7.0         Rcpp_1.0.13        sf_1.0-17          xfun_0.47          tidyselect_1.2.1   rstudioapi_0.16.0  knitr_1.48        
[41] htmltools_0.5.8.1  rmarkdown_2.28     compiler_4.4.1  
ran-codes commented 1 month ago

I have a similiar issue. specifically in a webassemly environment. Please let me know if this should be a separate issue.

Reprex


```{webr}
#| edit: false

library(dplyr)
library(duckdb)

url <- "https://huggingface.co/datasets/SALURBAL/salurbal-metadata/resolve/refs%2Fconvert%2Fparquet/default/train/0000.parquet"

# Create a connection to DuckDB
con <- dbConnect(duckdb())

# Install and load the httpfs extension
dbExecute(con, "INSTALL httpfs;")
dbExecute(con, "LOAD httpfs;") 

## Query
result <- dbGetQuery(con, sprintf("SELECT * FROM parquet_scan('%s') LIMIT 5", url))

See this Webr-notebook with the error

R Version

R version 4.4.1 (2024-06-14)
Platform: wasm32-unknown-emscripten (32-bit)
Running under: emscripten

Matrix products: default

locale:
[1] en_US.UTF-8 C           en_US.UTF-8 en_US.UTF-8 en_US.UTF-8 C          

time zone: America/Indianapolis
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] duckdb_1.0.0-2    DBI_1.2.3         dplyr_1.1.4       htmltools_0.5.8.1
[5] knitr_1.48        evaluate_0.24.0  

loaded via a namespace (and not attached):
 [1] digest_0.6.37    utf8_1.2.4       R6_2.5.1         fastmap_1.2.0   
 [5] tidyselect_1.2.1 xfun_0.47        webr_0.4.1       magrittr_2.0.3  
 [9] glue_1.7.0       tibble_3.2.1     pkgconfig_2.0.3  generics_0.1.3  
[13] lifecycle_1.0.4  cli_3.6.3        fansi_1.0.6      vctrs_0.6.5     
[17] tools_4.4.1      pillar_1.9.0     rlang_1.1.4     
eitsupi commented 1 month ago

I have a similiar issue. specifically in a webassemly environment. Please let me know if this should be a separate issue.

I think that is duplicate of #66

but this has been a persistent problem in my computer at the office (also Windows).

Could it be a proxy issue? You should check duckdb/duckdb#13368 In general, it is a good practice to check if it is an R-specific problem or if the same problem occurs with other clients. I recommend to check if the same error occurs in the CLI.