RBioFormats icon indicating copy to clipboard operation
RBioFormats copied to clipboard

Installation stuck at step "testing if installed package can be loaded from temporary location"

Open QuinceyLv opened this issue 1 year ago • 2 comments

Hi, I tried to install RBioFormats on R4.3.0:

BiocManager::install("aoles/RBioFormats")

── R CMD build ─────────────────────────────────────────────────────────────────

  • checking for file ‘/tmp/9771460.1.SC1.q/RtmptHlfNa/remotes5b886ec82ce9/aoles-RBioFormats-5ec5fad/DESCRIPTION’ ... OK

  • preparing ‘RBioFormats’:

  • checking DESCRIPTION meta-information ... OK

  • checking for LF line-endings in source and make files and shell scripts

  • checking for empty or unneeded directories

  • building ‘RBioFormats_0.99.14.tar.gz’

  • installing source package ‘RBioFormats’ ... ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location

and the installation stuck at this step. How could I solve this? Thanks in advance.

QuinceyLv avatar Oct 12 '23 06:10 QuinceyLv

It seems that it's trying to download Bio-Formats at this stage, which can take a while depending on your internet, and I got

Warning in utils::download.file(bf_url, bf_jar, mode = "wb", quiet = FALSE) :
  downloaded length 0 != reported length 0
Warning in utils::download.file(bf_url, bf_jar, mode = "wb", quiet = FALSE) :
  URL 'https://downloads.openmicroscopy.org/bio-formats/6.12.0/artifacts/bioformats_package.jar': Timeout of 100 seconds was reached
Error: package or namespace load failed for ‘RBioFormats’:
 .onLoad failed in loadNamespace() for 'RBioFormats', details:
  call: NULL
  error: Failed to download Bio-Formats Java library.
  Check your internet connection and try again. Consider setting the environment variable R_DEFAULT_INTERNET_TIMEOUT to a value higher than 100.
Error: loading failed
Execution halted

Setting Sys.setenv(R_DEFAULT_INTERNET_TIMEOUT = 2000) solved the problem for me. Maybe use a larger value if your internet is slower.

lambdamoses avatar Oct 27 '23 19:10 lambdamoses

It seems that it's trying to download Bio-Formats at this stage, which can take a while depending on your internet, and I got

Warning in utils::download.file(bf_url, bf_jar, mode = "wb", quiet = FALSE) :
  downloaded length 0 != reported length 0
Warning in utils::download.file(bf_url, bf_jar, mode = "wb", quiet = FALSE) :
  URL 'https://downloads.openmicroscopy.org/bio-formats/6.12.0/artifacts/bioformats_package.jar': Timeout of 100 seconds was reached
Error: package or namespace load failed for ‘RBioFormats’:
 .onLoad failed in loadNamespace() for 'RBioFormats', details:
  call: NULL
  error: Failed to download Bio-Formats Java library.
  Check your internet connection and try again. Consider setting the environment variable R_DEFAULT_INTERNET_TIMEOUT to a value higher than 100.
Error: loading failed
Execution halted

Setting Sys.setenv(R_DEFAULT_INTERNET_TIMEOUT = 2000) solved the problem for me. Maybe use a larger value if your internet is slower.

Thanks for reply. I had checked zzz.R and found:

if ( !file.exists(bf_jar) ) {
    # The default for timing out the file download is 60s
    # Temporarily increase it if this is the case
    orig_timeout <- getOption("timeout")
    options(timeout = max(100, orig_timeout))
    tryCatch(utils::download.file(bf_url, bf_jar, mode = "wb", quiet = FALSE),
             error = function(e) {
               file.remove(bf_jar)
               stop(
                 "Failed to download Bio-Formats Java library.\n  Check your internet connection and try again. Consider setting the environment variable R_DEFAULT_INTERNET_TIMEOUT to a value higher than 100.",
                 call.=FALSE)
             },
    finally=options(timeout = orig_timeout)
    )
  }
}

I tried to change the timeout or to download the jar package manually and change the "download.file" to "file.copy" from local, but either worked. Maybe Sys.setenv(R_DEFAULT_INTERNET_TIMEOUT = 2000) could save me...?

QuinceyLv avatar Oct 28 '23 04:10 QuinceyLv