Skip to content

package httr2 missing when downloading from Google Drive #456

@suz-estella

Description

@suz-estella

When using reproducible@development, attempting to download a dummy text file from Google Drive fails:

EDIT: I am working on a Windows computer with R version 4.5.0.

libPath <- file.path(tempdir(), "packages")
dir.create(libPath, recursive = TRUE)
.libPaths(c(libPath, .libPaths()[-1]))

install.packages("remotes", dependencies = TRUE)
remotes::install_github("PredictiveEcology/reproducible@development", dependencies = "Imports")

# Download the suggested googledrive package to enable downloading from googledrive
install.packages("googledrive")

# Check that downloading the file directly from googledrive runs successfully
## This downloads the file without issue
googledrive::drive_download("https://drive.google.com/file/d/1c-D9TaGHKej3O1MFoOcRXAIzYrFGbGD9")

# Try using reproducible to download the file
reproducible::prepInputs(
  url = "https://drive.google.com/file/d/1c-D9TaGHKej3O1MFoOcRXAIzYrFGbGD9",
  destinationPath = file.path(tempdir(), "inputs"),
  targetFile = "test_file.txt",
  fun = NA)

Fails with error:

Error in retry(downloadCall, retries = 2) : 
  Error in loadNamespace(x) : there is no package called ‘httr2’

Installing httr2 then allows the file to download successfully, but the output messages contain the error text that rvest is not available:

Running prepInputs
Running `preProcess`
File on Google Drive is 13 bytes
Preparing: test_file.txt
alsoExtract is unspecified; assuming that all files must be extracted
Skipping download. All requested files already present
Loading required namespace: rvest
Failed with error:  ‘there is no package called ‘rvest’’
`reproducible` does not know the file type passed.
Please run `install.packages('rvest')` to load other known file types that the `sf` package can load.
 No loading of object into R; fun = NA; returning the targetFilePath:
   [omitted]/inputs/test_file.txt

Finally, installing rvest allows the file to download without issue:

install.packages("rvest")

reproducible::prepInputs(
  url = "https://drive.google.com/file/d/1c-D9TaGHKej3O1MFoOcRXAIzYrFGbGD9",
  destinationPath = file.path(tempdir(), "inputs2"),
  targetFile = "test_file.txt",
  fun = NA)

Is it up to the user to make sure that these 2 additional packages are available when downloading from Google Drive? I already have googledrive added as an additional required package for my SpaDES module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions