Skip to content

Failure to install on Ubuntu system #634

Open

Description

@lorenzoFabbri
> renv::install("rstanarm")
# Downloading packages --------------------------------------
- Downloading rstanarm from CRAN ...            OK [file is up to date]
Successfully downloaded 1 package in 0.8 seconds.

The following package(s) will be installed:
- rstanarm [2.32.1]
These packages will be installed into "~/Documents/edu/phd/papers/paper-athlete-neuro/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu".

Do you want to proceed? [Y/n]: Y

# Installing packages ---------------------------------------
- Installing rstanarm ...                       FAILED
Error: Error installing package 'rstanarm':
====================================

* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** using staged installation
Setting `RoxygenNote` to "7.3.2"
Writing 'NAMESPACE'
Loading required package: Rcpp
Loading required package: bayesplot
This is bayesplot version 1.11.1
- Online documentation and vignettes at mc-stan.org/bayesplot
- bayesplot theme set to bayesplot::theme_default()
   * Does _not_ affect other ggplot2 plots
   * See ?bayesplot_theme_set for details on theme setting
Loading required package: ggplot2
Loading required package: lme4
Loading required package: Matrix
Loading required package: loo
This is loo version 2.8.0
- Online documentation and vignettes at mc-stan.org/loo
- As of v2.0.0 loo defaults to 1 core but we recommend using as many as possible. Use the 'cores' argument or set options(mc.cores = NUM_CORES) for an entire session. 
Loading required package: nlme

Attaching package: ‘nlme’

The following object is masked from ‘package:lme4’:

    lmList

Loading required package: posterior
This is posterior version 1.6.0

Attaching package: ‘posterior’

The following object is masked from ‘package:bayesplot’:

    rhat

The following objects are masked from ‘package:stats’:

    mad, sd, var

The following objects are masked from ‘package:base’:

    %in%, match

Loading required package: rstan
Loading required package: StanHeaders

rstan version 2.32.6 (Stan version 2.32.2)

For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
For within-chain threading using `reduce_sum()` or `map_rect()` Stan functions,
change `threads_per_chain` option:
rstan_options(threads_per_chain = 1)


Attaching package: ‘rstan’

The following objects are masked from ‘package:posterior’:

    ess_bulk, ess_tail

Loading required package: rstantools
This is rstantools version 2.4.0
Loading required package: shinystan
Loading required package: shiny

This is shinystan version 2.6.0

Loading required package: survival
Loading required package: RcppParallel

Attaching package: ‘RcppParallel’

The following object is masked from ‘package:Rcpp’:

    LdFlags

✖ doc-rstanarm-package.R:107: `@docType "package"` is deprecated.
ℹ Please document "_PACKAGE" instead.
Error in `map2()` at roxygen2/R/namespace.R:405:3:
ℹ In index: 1.
ℹ With name: collapse_within_groups.matrix.
Caused by error in `basename()`:
! a character vector argument expected
Backtrace:
     ▆
  1. ├─roxygen2::roxygenize(load_code = roxygen2::load_source, clean = TRUE)
  2. │ └─base::lapply(...) at roxygen2/R/roxygenize.R:79:3
  3. │   ├─roxygen2 (local) FUN(X[[i]], ...)
  4. │   └─roxygen2:::roclet_process.roclet_namespace(X[[i]], ...) at roxygen2/R/roclet.R:56:3
  5. │     └─roxygen2:::warn_missing_s3_exports(blocks, env) at roxygen2/R/namespace.R:35:3
  6. │       └─purrr::map2(...) at roxygen2/R/namespace.R:405:3
  7. │         └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress) at purrr/R/map2.R:34:3
  8. │           ├─purrr:::with_indexed_errors(...) at purrr/R/map2.R:78:3
  9. │           │ └─base::withCallingHandlers(...) at purrr/R/map.R:201:3
 10. │           ├─purrr:::call_with_cleanup(...) at purrr/R/map2.R:78:3
 11. │           └─roxygen2 (local) .f(.x[[i]], .y[[i]], ...)
 12. │             └─roxygen2:::warn_roxy_function(fun, "S3 method {.arg {name}} needs @export or @exportS3method tag") at roxygen2/R/namespace.R:406:5
 13. │               └─roxygen2:::warn_roxy(file, line, message, parent = parent, envir = envir) at roxygen2/R/utils-warn.R:21:3
 14. │                 ├─cli::style_hyperlink(...) at roxygen2/R/utils-warn.R:25:3
 15. │                 ├─base::paste0(basename(file), ":", line) at roxygen2/R/utils-warn.R:25:3
 16. │                 └─base::basename(file) at roxygen2/R/utils-warn.R:25:3
 17. └─base::.handleSimpleError(...)
 18.   └─purrr (local) h(simpleError(msg, call))
 19.     └─cli::cli_abort(...) at purrr/R/map.R:215:9
 20.       └─rlang::abort(...) at cli/R/rlang.R:45:3
Execution halted
ERROR: a 'NAMESPACE' file is required
* removing ‘/home/lfabbri/Documents/edu/phd/papers/paper-athlete-neuro/renv/staging/2/rstanarm’
install of package 'rstanarm' failed [error code 1]
Traceback (most recent calls last):
12: renv::install("rstanarm")
11: renv_install_impl(records) at install.R#232
10: if (staged)
      renv_install_staged(records)
    else
      renv_install_default(records) at install.R#276
 9: renv_install_default(records) at install.R#296
 8: handler(package, renv_install_package(record)) at install.R#399
 7: handler(package, renv_install_package(record)) at install.R#399
 6: withCallingHandlers(
      renv_install_package_impl(record),
      error = function(e) writef("FAILED")
    ) at install.R#432
 5: withCallingHandlers(
      renv_install_package_impl(record),
      error = function(e) writef("FAILED")
    ) at install.R#432
 4: if (copyable)
      renv_file_copy(path, installpath, overwrite = TRUE)
    else
      r_cmd_install(package, path) at install.R#643
 3: if (!identical(status, 0L))
      r_exec_error(package, output, "install", status) at r.R#234
 2: abort(all) at r.R#52
 1: stop(fallback) at abort.R#44
> Sys.info()
                                                           sysname 
                                                           "Linux" 
                                                           release 
                                                "6.8.0-52-generic" 
                                                           version 
"#53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2" 
                                                          nodename 
                                                       "ISG10223L" 
                                                           machine 
                                                          "x86_64"
> R.Version()
$platform
[1] "x86_64-pc-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "4"

$minor
[1] "4.2"

$year
[1] "2024"

$month
[1] "10"

$day
[1] "31"

$`svn rev`
[1] "87279"

$language
[1] "R"

$version.string
[1] "R version 4.4.2 (2024-10-31)"

$nickname
[1] "Pile of Leaves"

Both rstan and brms seem to be working fine.

Activity

  1. andrjohns commented on Feb 24, 2025

    @andrjohns
    Contributor

    What output do you get if you use the standard install.packages("rstanarm")?

  2. lorenzoFabbri commented on Feb 24, 2025

    @lorenzoFabbri
    Author

    I obtain the same error message:

    > install.packages("rstanarm")
    # Downloading packages --------------------------------------
    - Downloading rstanarm from CRAN ...            OK [file is up to date]
    Successfully downloaded 1 package in 0.81 seconds.
    
    The following package(s) will be installed:
    - rstanarm [2.32.1]
    These packages will be installed into "~/Documents/edu/phd/papers/paper-athlete-neuro/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu".
    
    Do you want to proceed? [Y/n]: Y
    
    # Installing packages ---------------------------------------
    - Installing rstanarm ...                       FAILED
    Error: Error installing package 'rstanarm':
    ====================================
    
    * installing *source* package ‘rstanarm’ ...
    ** package ‘rstanarm’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Setting `RoxygenNote` to "7.3.2"
    Writing 'NAMESPACE'
    Loading required package: Rcpp
    Loading required package: bayesplot
    This is bayesplot version 1.11.1
    - Online documentation and vignettes at mc-stan.org/bayesplot
    - bayesplot theme set to bayesplot::theme_default()
       * Does _not_ affect other ggplot2 plots
       * See ?bayesplot_theme_set for details on theme setting
    Loading required package: ggplot2
    Loading required package: lme4
    Loading required package: Matrix
    Loading required package: loo
    This is loo version 2.8.0
    - Online documentation and vignettes at mc-stan.org/loo
    - As of v2.0.0 loo defaults to 1 core but we recommend using as many as possible. Use the 'cores' argument or set options(mc.cores = NUM_CORES) for an entire session. 
    Loading required package: nlme
    
    Attaching package: ‘nlme’
    
    The following object is masked from ‘package:lme4’:
    
        lmList
    
    Loading required package: posterior
    This is posterior version 1.6.0
    
    Attaching package: ‘posterior’
    
    The following object is masked from ‘package:bayesplot’:
    
        rhat
    
    The following objects are masked from ‘package:stats’:
    
        mad, sd, var
    
    The following objects are masked from ‘package:base’:
    
        %in%, match
    
    Loading required package: rstan
    Loading required package: StanHeaders
    
    rstan version 2.32.6 (Stan version 2.32.2)
    
    For execution on a local, multicore CPU with excess RAM we recommend calling
    options(mc.cores = parallel::detectCores()).
    To avoid recompilation of unchanged Stan programs, we recommend calling
    rstan_options(auto_write = TRUE)
    For within-chain threading using `reduce_sum()` or `map_rect()` Stan functions,
    change `threads_per_chain` option:
    rstan_options(threads_per_chain = 1)
    
    
    Attaching package: ‘rstan’
    
    The following objects are masked from ‘package:posterior’:
    
        ess_bulk, ess_tail
    
    Loading required package: rstantools
    This is rstantools version 2.4.0
    Loading required package: shinystan
    Loading required package: shiny
    
    This is shinystan version 2.6.0
    
    Loading required package: survival
    Loading required package: RcppParallel
    
    Attaching package: ‘RcppParallel’
    
    The following object is masked from ‘package:Rcpp’:
    
        LdFlags
    
    ✖ doc-rstanarm-package.R:107: `@docType "package"` is deprecated.
    ℹ Please document "_PACKAGE" instead.
    Error in `map2()` at roxygen2/R/namespace.R:405:3:
    ℹ In index: 1.
    ℹ With name: collapse_within_groups.matrix.
    Caused by error in `basename()`:
    ! a character vector argument expected
    Backtrace:
         ▆
      1. ├─roxygen2::roxygenize(load_code = roxygen2::load_source, clean = TRUE)
      2. │ └─base::lapply(...) at roxygen2/R/roxygenize.R:79:3
      3. │   ├─roxygen2 (local) FUN(X[[i]], ...)
      4. │   └─roxygen2:::roclet_process.roclet_namespace(X[[i]], ...) at roxygen2/R/roclet.R:56:3
      5. │     └─roxygen2:::warn_missing_s3_exports(blocks, env) at roxygen2/R/namespace.R:35:3
      6. │       └─purrr::map2(...) at roxygen2/R/namespace.R:405:3
      7. │         └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress) at purrr/R/map2.R:34:3
      8. │           ├─purrr:::with_indexed_errors(...) at purrr/R/map2.R:78:3
      9. │           │ └─base::withCallingHandlers(...) at purrr/R/map.R:201:3
     10. │           ├─purrr:::call_with_cleanup(...) at purrr/R/map2.R:78:3
     11. │           └─roxygen2 (local) .f(.x[[i]], .y[[i]], ...)
     12. │             └─roxygen2:::warn_roxy_function(fun, "S3 method {.arg {name}} needs @export or @exportS3method tag") at roxygen2/R/namespace.R:406:5
     13. │               └─roxygen2:::warn_roxy(file, line, message, parent = parent, envir = envir) at roxygen2/R/utils-warn.R:21:3
     14. │                 ├─cli::style_hyperlink(...) at roxygen2/R/utils-warn.R:25:3
     15. │                 ├─base::paste0(basename(file), ":", line) at roxygen2/R/utils-warn.R:25:3
     16. │                 └─base::basename(file) at roxygen2/R/utils-warn.R:25:3
     17. └─base::.handleSimpleError(...)
     18.   └─purrr (local) h(simpleError(msg, call))
     19.     └─cli::cli_abort(...) at purrr/R/map.R:215:9
     20.       └─rlang::abort(...) at cli/R/rlang.R:45:3
    Execution halted
    ERROR: a 'NAMESPACE' file is required
    * removing ‘/home/lfabbri/Documents/edu/phd/papers/paper-athlete-neuro/renv/staging/2/rstanarm’
    install of package 'rstanarm' failed [error code 1]
    Traceback (most recent calls last):
    15: install.packages("rstanarm")
    14: eval(call, envir = parent.frame()) at shims.R#45
    13: eval(call, envir = parent.frame())
    12: renv::install("rstanarm")
    11: renv_install_impl(records) at install.R#232
    10: if (staged)
          renv_install_staged(records)
        else
          renv_install_default(records) at install.R#276
     9: renv_install_default(records) at install.R#296
     8: handler(package, renv_install_package(record)) at install.R#399
     7: handler(package, renv_install_package(record)) at install.R#399
     6: withCallingHandlers(
          renv_install_package_impl(record),
          error = function(e) writef("FAILED")
        ) at install.R#432
     5: withCallingHandlers(
          renv_install_package_impl(record),
          error = function(e) writef("FAILED")
        ) at install.R#432
     4: if (copyable)
          renv_file_copy(path, installpath, overwrite = TRUE)
        else
          r_cmd_install(package, path) at install.R#643
     3: if (!identical(status, 0L))
          r_exec_error(package, output, "install", status) at r.R#234
     2: abort(all) at r.R#52
     1: stop(fallback) at abort.R#44
  3. andrjohns commented on Feb 24, 2025

    @andrjohns
    Contributor

    Can you try the installation outside of an active renv session? It's still delegating to renv::install()

  4. lorenzoFabbri commented on Feb 24, 2025

    @lorenzoFabbri
    Author

    For that I need more time because apparently it's having issues installing some packages:

    ERROR: compilation failed for package ‘RcppEigen’
    * removing ‘/home/lfabbri/R/x86_64-pc-linux-gnu-library/4.4/RcppEigen’
    Warning in install.packages :
      installation of package ‘RcppEigen’ had non-zero exit status

    RcppEigen is installed corrently in the R environment. I'll try again.

  5. schuettl commented on Apr 10, 2025

    @schuettl

    I ran into the same issue on a Ubuntu 20 VM. I can install the package outside my renv environment. But it gives the same error when installing via renv.

  6. andrjohns commented on Apr 10, 2025

    @andrjohns
    Contributor

    I ran into the same issue on a Ubuntu 20 VM. I can install the package outside my renv environment. But it gives the same error when installing via renv.

    If it can be installed normally but fails to install under renv, then there's likely some renv-specific configuration or issue. I think your best would be to open an issue in the renv github: https://github.com/rstudio/renv/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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