idem-lab / map-ir-pipeline

Prototype demonstration of stacked generalisation method used in https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3000633#sec010
3 stars 1 forks source link

package installation errors #68

Closed goldingn closed 1 week ago

goldingn commented 7 months ago

After doing:

install.packages(
    "capsule", 
    repos = c(mm = "https://milesmcbain.r-universe.dev", getOption("repos")))
capsule::run(targets::tar_make())

per the readme, I get package absence errors. In this call I got a notification that ragg didn't compile:

- Installing textshaping ...                    OK [installed binary and cached in 0.85s]
- Installing ragg ...                           FAILED

The end of the error message was:

clang++ -arch arm64 -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o ragg.so capture_dev.o init.o jpeg_dev.o png_dev.o ppm_dev.o tiff_dev.o -Lagg -lstatagg -L/opt/homebrew/opt/freetype/lib -L/opt/homebrew/Cellar/libpng/1.6.39/lib -L/opt/homebrew/Cellar/libtiff/4.4.0_1/lib -L/opt/homebrew/Cellar/jpeg-turbo/2.1.5.1/lib -lfreetype -lbz2 -lpng16 -lz -ltiff -lzstd -ljpeg -lz -ljpeg -ljpeg -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ragg.so] Error 1
ERROR: compilation failed for package ‘ragg’
* removing ‘/Users/nick/Dropbox/github/map-ir-pipeline/renv/library/R-4.2/aarch64-apple-darwin20/.renv/1/ragg’
install of package 'ragg' failed [error code 1]
Warning message:
In max(n) : no non-missing arguments to max; returning -Inf

So I suspect this may be to do with macos and homebrew doing silly things with linking and renaming compilers.

Before trying to fix this compiler issue, I first checked I could reproduce the error, and I can't. I tried running capsule::run(targets::tar_make()) again, and this time I got:

Error: 
! in callr subprocess.
Caused by error: 
! Error running targets::tar_make()
  Error messages: targets::tar_meta(fields = error, complete_only = TRUE)
  Debugging guide: https://books.ropensci.org/targets/debugging.html
  How to ask for help: https://books.ropensci.org/targets/help.html
  Last error: there is no package called ‘crew’
Type .Last.error to see the more details.

so I manually installed crew, thengeotargets, then mapview. Then I looked at the packages.R file and saw that the list of things to install manually would be very long and I'd probably get an incorrect version in there. So I stopped. How to I trigger the reinstallation of these other packages so I can replicate the ragg installation issue?

goldingn commented 7 months ago

I tried manually installing ragg from cran (this has a later version than in the lockfile, so it installed from the binary quickly with no compilation errors), and then ran capsule::dev_mirror_lockfile() to see if I could get capsule to update all the others.

It tripped up on igraph compilation this time. So I manually installed igraph from the CRAN binary (2.0.3), then ran capsule::dev_mirror_lockfile() again. However this time it tried to recompile igraph from source (even though the lockfile has 2.0.2 and I installed 2.0.3) and failed again.

Note: I had thought that installing packages in the session like this would update the default package library, not the renv. So I would understand why this approach would not work. But it clearly does work for making those packages appear when doing capsule::run(), which confuses me.

Is there a way to manually install packages to the renv using capsule?

goldingn commented 7 months ago

I worked around this by ditching capsule, installing the remaining cran packages with RStudio's helpful prompt, and finding and installing the remaining github packages

njtierney commented 7 months ago

Ah man I'm so sorry about that - I had high hopes this would all work out of the tin, but there was something spooky going on with capsule and renv. I should change the README to reflect this!

goldingn commented 1 week ago

This is working, so closing and we can open a new one next time we have this pain!