microbiomedata / nmdc_notebooks

Jupyter Notebooks demonstrating R and Python-based access to NMDC metadata and data
Creative Commons Zero v1.0 Universal
5 stars 0 forks source link

Upgrade package versions in `renv` to resolve gcc errors during environment setup on Ubuntu #50

Closed bmeluch closed 2 months ago

bmeluch commented 3 months ago

Describe the bug Using Ubuntu 22.04

I'm trying to use renv to generate the reproducible environment to run the R notebooks in. When using renv::restore() to install the packages according to renv.lock, I run into several packages that will not compile due to the same error:

error: format not a string literal and no format arguments [-Werror=format-security]

tl;dr copious googling led me here: https://www.github.com/RcppCore/Rcpp/issues/1287

It looks like this issue has been fixed for many packages right around the time that renv.lock was last updated. I think that the RSPM repo gets new versions of packages a little slower than CRAN, so those packages in particular may not have picked up this fix.

I'm new to using renv, and I didn't create the environment - is there an easy way to upgrade packages and recreate the renv files in a way that won't trip us up? @kheal

To Reproduce Steps to reproduce the behavior:

  1. Be using Ubuntu sometime since like 2013 or so
  2. Run renv::restore() in notebook repo directory
  3. Eventually one of the packages (so far all the bad ones have been from RSPM) won't compile, installation aborts

Expected behavior Packages should install into renv directory, using versions and repos specified by the lockfile.

kheal commented 3 months ago

Ooofta, this is annoying. I can't recreate locally bc I'm not an ubuntu user.

Can you try a couple things first? 1) initialize an empty renv 2) install Rcpp with exact version noted in lock file 3) install one of the problematic packages with exact version noted in lock file

If you get the same error as you note, try this: 1) initialize an empty renv 2) install Rcpp (newest version from CRAN) 3) install one of the problematic packages (newest version from CRAN)

A fix I can think of is for me to re-generate a lock file after updating all the packages to their newest release.

kheal commented 3 months ago

Hi @bmeluch - can you try checking out this branch: https://github.com/microbiomedata/nmdc_notebooks/tree/50-upgrade-package-versions-in-renv-to-resolve-gcc-errors-during-environment-setup-on-ubuntu and running renv::restore() on your system? If that works for you I'll put in a PR to make those changes. renv doesn't really play well with jupyter notebooks, so I've made a little work around to help us out.

bmeluch commented 2 months ago
  1. initialize an empty renv
  2. install Rcpp with exact version noted in lock file
  3. install one of the problematic packages with exact version noted in lock file

Same error

  1. initialize an empty renv
  2. install Rcpp (newest version from CRAN)
  3. install one of the problematic packages (newest version from CRAN)

This worked! which means that

Hi @bmeluch - can you try checking out this branch: https://github.com/microbiomedata/nmdc_notebooks/tree/50-upgrade-package-versions-in-renv-to-resolve-gcc-errors-during-environment-setup-on-ubuntu and running renv::restore() on your system? If that works for you I'll put in a PR to make those changes. renv doesn't really play well with jupyter notebooks, so I've made a little work around to help us out.

this worked also! they all installed, no problems. Thank you. renv does not like jupyter notebooks indeed.