From 40c28d2f4a37ee2bfcc54019b88dde15c1dc022f Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Fri, 8 May 2026 10:14:28 -0700 Subject: [PATCH] updates to all images but r still has maap-py bug --- base_images/2i2c/isce3/environment.yml | 8 +- base_images/2i2c/pangeo/docker/Dockerfile | 2 - base_images/2i2c/pangeo/environment.yml | 4 +- base_images/2i2c/pytorch/docker/Dockerfile | 2 +- base_images/2i2c/pytorch/environment.yml | 2 +- base_images/2i2c/r-base/docker/Dockerfile | 60 +++--- base_images/2i2c/r-base/environment.yml | 16 +- base_images/2i2c/r-base/scripts/install2.r | 186 ------------------ .../r-base/scripts/install_cran_packages_r.sh | 76 ++++--- .../r-base/scripts/print_package_versions.R | 55 ------ .../r-base/scripts/r_package_versions.txt | 45 ----- base_images/2i2c/r/docker/Dockerfile | 13 +- base_images/2i2c/r/environment.yml | 2 +- base_images/2i2c/r/scripts/init-user.sh | 7 + .../2i2c/tensorflow2/docker/Dockerfile | 6 +- base_images/2i2c/tensorflow2/environment.yml | 2 +- 16 files changed, 110 insertions(+), 376 deletions(-) delete mode 100644 base_images/2i2c/r-base/scripts/install2.r delete mode 100644 base_images/2i2c/r-base/scripts/print_package_versions.R delete mode 100644 base_images/2i2c/r-base/scripts/r_package_versions.txt create mode 100644 base_images/2i2c/r/scripts/init-user.sh diff --git a/base_images/2i2c/isce3/environment.yml b/base_images/2i2c/isce3/environment.yml index f55e56e..14ed989 100644 --- a/base_images/2i2c/isce3/environment.yml +++ b/base_images/2i2c/isce3/environment.yml @@ -52,14 +52,14 @@ dependencies: - unidecode=1.4.0 - unzip=6.0 - xarray=2026.4.0 - - pip=26.0.1 + - pip=26.1.1 - pip: - - jupyter-resource-usage==1.2.0 + - jupyter-resource-usage==1.2.1 - jupyter-sshd-proxy==0.3.0 - jupyterlab-bxplorer==0.2.30 # - git+https://github.com/MAAP-Project/stac_ipyleaflet.git@0.3.6 - - morecantile==6.1.0 - - rio-tiler==7.2.2 + - morecantile==7.0.3 + - rio-tiler==9.0.6 - maap-py==4.2.0 - maap-algorithms-jupyter-extension==0.5.1 - maap-jupyter-server-extension==3.0.0 diff --git a/base_images/2i2c/pangeo/docker/Dockerfile b/base_images/2i2c/pangeo/docker/Dockerfile index d60f5eb..2b56ba9 100644 --- a/base_images/2i2c/pangeo/docker/Dockerfile +++ b/base_images/2i2c/pangeo/docker/Dockerfile @@ -18,8 +18,6 @@ RUN conda env update -n ${CONDA_ENV} -f "/tmp/environment.yml" \ RUN conda init -RUN jupyter server extension enable maap_jupyter_server_extension - USER root COPY scripts/init-user.sh /usr/local/bin/init-user.sh RUN chmod +x /usr/local/bin/init-user.sh diff --git a/base_images/2i2c/pangeo/environment.yml b/base_images/2i2c/pangeo/environment.yml index d162cf6..a196470 100644 --- a/base_images/2i2c/pangeo/environment.yml +++ b/base_images/2i2c/pangeo/environment.yml @@ -6,9 +6,9 @@ dependencies: - icu=78.2 - nodejs=22.22.0 - rustac=0.9.9 - - pip=26.0.1 + - pip=26.1.1 - pip: - - rio-tiler==8.0.5 + - rio-tiler==9.0.6 - maap-py==4.2.0 - maap-algorithms-jupyter-extension==0.5.1 - maap-jupyter-server-extension==3.0.0 diff --git a/base_images/2i2c/pytorch/docker/Dockerfile b/base_images/2i2c/pytorch/docker/Dockerfile index 611a89b..5d08aa3 100644 --- a/base_images/2i2c/pytorch/docker/Dockerfile +++ b/base_images/2i2c/pytorch/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/pangeo/pytorch-notebook:2025.12.30 +FROM quay.io/pangeo/pytorch-notebook:2026.04.29 ENV LANG=en_US.UTF-8 ENV TZ=US/Pacific ARG DEBIAN_FRONTEND=noninteractive diff --git a/base_images/2i2c/pytorch/environment.yml b/base_images/2i2c/pytorch/environment.yml index 21ab024..65e08f6 100644 --- a/base_images/2i2c/pytorch/environment.yml +++ b/base_images/2i2c/pytorch/environment.yml @@ -6,7 +6,7 @@ dependencies: # Dependencies for VS Code IDE - code-server>=3.2 - jupyter-vscode-proxy=0.7 - - pre_commit=3.4.0 + - pre_commit # Upgrade from py torch notebook image - earthaccess>=0.16.0 # Pin down to avoid https://github.com/holoviz/pyviz_comms/issues/143 diff --git a/base_images/2i2c/r-base/docker/Dockerfile b/base_images/2i2c/r-base/docker/Dockerfile index 6cd925e..dda9542 100644 --- a/base_images/2i2c/r-base/docker/Dockerfile +++ b/base_images/2i2c/r-base/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial-2:2026.01.25 +FROM ghcr.io/nmfs-opensci/container-images/py-rocket-geospatial-2:2026.02.18 ENV LANG=en_US.UTF-8 ENV TZ=US/Pacific ARG DEBIAN_FRONTEND=noninteractive @@ -9,34 +9,38 @@ USER root # R will be completely separate from conda RUN apt-get clean && apt-get update && \ apt-get install -y --no-install-recommends \ - gdal-bin=3.8.4+dfsg-3ubuntu3 \ - lbzip2=2.5-2.3 \ - libfftw3-dev=3.3.10-1ubuntu3 \ - libgdal-dev=3.8.4+dfsg-3ubuntu3 \ - libgeos-dev=3.12.1-3build1 \ - libgl1-mesa-dev=25.0.7-0ubuntu0.24.04.2 \ - libglu1-mesa-dev=9.0.2-1.1build1 \ - libhdf4-alt-dev=4.2.16-4build1 \ - libhdf5-dev=1.10.10+repack-3.1ubuntu4 \ - libjq-dev=1.7.1-3ubuntu0.24.04.1 \ - libpq-dev=16.11-0ubuntu0.24.04.1 \ - libproj-dev=9.4.0-1build2 \ - libprotobuf-dev=3.21.12-8.2ubuntu0.2 \ - libnetcdf-dev=1:4.9.2-5ubuntu4 \ - libsqlite3-dev=3.45.1-1ubuntu2.5 \ - libssl-dev=3.0.13-0ubuntu3.6 \ - libudunits2-dev=2.2.28-7build1 \ - netcdf-bin=1:4.9.2-5ubuntu4 \ - postgis=3.4.2+dfsg-1ubuntu3 \ - protobuf-compiler=3.21.12-8.2ubuntu0.2 \ - sqlite3=3.45.1-1ubuntu2.5 \ - tk-dev=8.6.14build1 \ - unixodbc-dev=2.3.12-1ubuntu0.24.04.1 && \ + gdal-bin \ + lbzip2 \ + libfftw3-dev \ + libgdal-dev \ + libgeos-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libhdf4-alt-dev \ + libhdf5-dev \ + libjq-dev \ + libpq-dev \ + libproj-dev \ + libprotobuf-dev \ + libnetcdf-dev \ + libsqlite3-dev \ + libssl-dev \ + libudunits2-dev \ + netcdf-bin \ + postgis \ + protobuf-compiler \ + sqlite3 \ + tk-dev \ + unixodbc-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* USER ${NB_USER} +# Use sharded repodata for faster resolve times +RUN conda install --name base 'conda-libmamba-solver>=25.11.0' -y +RUN conda config --set plugins.use_sharded_repodata true + # Install additional packages from environment.yml COPY ./environment.yml /tmp RUN conda env update -n ${CONDA_ENV} -f "/tmp/environment.yml" \ @@ -47,6 +51,14 @@ RUN conda env update -n ${CONDA_ENV} -f "/tmp/environment.yml" \ RUN conda init USER root + +# Set default CRAN mirror to use pre-built binaries from Posit Package Manager +RUN R_HOME=$(R RHOME) && \ + echo "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/noble/latest'))" >> "$R_HOME/etc/Rprofile.site" + +# Install pak for better package management +RUN Rscript -e "install.packages('pak', repos = sprintf('https://r-lib.github.io/p/pak/devel/%s/%s/%s', .Platform\$pkgType, R.Version()\$os, R.Version()\$arch))" + SHELL ["/bin/bash", "-c"] ADD . / RUN ["chmod", "+x", "/scripts/install_cran_packages_r.sh"] diff --git a/base_images/2i2c/r-base/environment.yml b/base_images/2i2c/r-base/environment.yml index 8a7485e..7051269 100644 --- a/base_images/2i2c/r-base/environment.yml +++ b/base_images/2i2c/r-base/environment.yml @@ -4,12 +4,18 @@ channels: - nodefaults dependencies: # Python packages only - NO R packages in conda - - gdal=3.10.2 - - nodejs=20.19.5 + - gdal>=3.12.2 + - nodejs>=20.20.2 + - pdal>=2.8.4 + - py-xgboost=3.2.0 + - python>=3.12.0 + - qgis>=3.44.7 + - rclone=1.74.0 - rtree=1.4.1 + - sqlite>=3.45 - unzip=6.0 - - pip=26.0 + - pip=26.1.1 - pip: # - git+https://github.com/MAAP-Project/stac_ipyleaflet.git@0.3.6 - - morecantile==6.1.0 - - rio-tiler==7.2.2 \ No newline at end of file + - morecantile==7.0.3 + - rio-tiler==9.0.6 \ No newline at end of file diff --git a/base_images/2i2c/r-base/scripts/install2.r b/base_images/2i2c/r-base/scripts/install2.r deleted file mode 100644 index 4a2d6d1..0000000 --- a/base_images/2i2c/r-base/scripts/install2.r +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env r -# -# A second example to install one or more packages, now with option parsing -# -# Copyright (C) 2011 - 2014 Dirk Eddelbuettel -# Copyright (C) 2014 - 2017 Carl Boettiger and Dirk Eddelbuettel -# Copyright (C) 2018 - 2023 Carl Boettiger, Dirk Eddelbuettel, Brandon Bertelsen, and SHIMA Tatsuya -# -# Released under GPL (>= 2) -# This file was extracted from this repository https://github.com/rocker-org/rocker-versioned2 -# The license of this repository (rocker-versioned2) can be view here: -# https://github.com/rocker-org/rocker-versioned2/blob/master/LICENSE - -# Warranty description we are required to convey: -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# Any questions, please contact: grace.llewellyn@jpl.nasa.gov - - -## load docopt package from CRAN -# Grace Llewellyn added the repos parameter to fix a bug -# Use first library location in .libPaths() for consistent installation -libloc <- .libPaths()[1] -install.packages('docopt', repos = "http://cran.us.r-project.org", lib = libloc) -library(docopt) - -## configuration for docopt -doc <- paste0("Usage: install2.r [-l LIBLOC] [-h] [-x] [-s] [-d DEPS] [-n NCPUS] [-r REPOS...] [-m METHOD] [-t TYPE] [--error] [--skipmissing] [--] [PACKAGES ...] - --l --libloc LIBLOC location in which to install [default: ", libloc, "] --d --deps DEPS install suggested dependencies as well [default: NA] --n --ncpus NCPUS number of processes to use for parallel install, -1 selects all cores [default: getOption] --r --repos REPOS repositor(y|ies) to use, or NULL for file [default: getOption] --e --error throw error and halt instead of a warning [default: FALSE] ---skipmissing use with the --error option, skip the packages missing error [default: FALSE] --s --skipinstalled skip installing already installed packages [default: FALSE] --m --method METHOD method to be used for downloading files [default: auto] --t --type TYPE installation type as used by `install.packages` [default: getOption] --h --help show this help text --x --usage show help and short example usage") -opt <- docopt(doc) # docopt parsing -if (opt$usage) { - cat(doc, "\n\n") - cat("where PACKAGES... can be one or more CRAN package names, or local (binary or source) -package files (where extensions .tar.gz, .tgz and .zip are recognised). Optional -arguments understood by R CMD INSTALL can be passed interspersed in the PACKAGES, though -this requires use of '--'. - -Examples: - install2.r -l /tmp/lib Rcpp BH # install into given library - install2.r -- --with-keep.source drat # keep the source - install2.r -- --data-compress=bzip2 stringdist # prefer bz2 compression - install2.r \".\" # install package in current directory - install2.r -n 6 ggplot2 # parallel install: (6 processes) - -install2.r is part of littler which brings 'r' to the command-line. -See https://dirk.eddelbuettel.com/code/littler.html for more information.\n") - q("no") -} -if (opt$deps == "TRUE" || opt$deps == "FALSE") { - opt$deps <- as.logical(opt$deps) -} else if (opt$deps == "NA") { - opt$deps <- NA -} -## docopt results are characters, so if we meant NULL we have to set NULL -if (length(opt$repos) == 1 && "NULL" %in% opt$repos) { - opt$repos <- NULL -} - -if ("getOption" %in% opt$repos) { - ## as littler can now read ~/.littler.r and/or /etc/littler.r we can preset elsewhere - opt$repos <- c(opt$repos[which(opt$repos != "getOption")], getOption("repos")) -} - -if (opt$ncpus == "getOption") { - opt$ncpus <- getOption("Ncpus", 1L) -} else if (opt$ncpus == "-1") { - ## parallel comes with R 2.14+ - opt$ncpus <- max(1L, parallel::detectCores()) -} - -## type should reflects bspm where available -if (opt$type == "getOption") { - opt$type <- getOption("pkgType") - #if (requireNamespace("bspm", quietly=TRUE) && Sys.info()[["sysname"]] == "Linux") opt$type <- "binary-source" - -} - -## ensure installation is stripped -Sys.setenv("_R_SHLIB_STRIP_"="true") -install_packages2 <- function(pkgs, ..., error = FALSE, skipmissing = FALSE, skipinstalled = FALSE) { - e <- NULL - capture <- function(e) { - if (error) { - catch <- - grepl("(download|installation) of package .* failed", e$message) || - (grepl("(dependenc|package).*(is|are) not available", e$message) && !skipmissing) || - grepl("installation of package.*had non-zero exit status", e$message) || - grepl("installation of .+ package(|s) failed", e$message) - if (catch) { - e <<- e - } - } - } - if (skipinstalled) { - pkgs <- setdiff(pkgs, installed.packages()[,1]) - } - if (length(pkgs) > 0) { - withCallingHandlers(install.packages(pkgs, ...), warning = capture) - if (!is.null(e)) { - stop(e$message, call. = FALSE) - } - } -} - -## helper function to for existing files with matching extension -isMatchingFile <- function(f) (file.exists(f) && grepl("(\\.tar\\.gz|\\.tgz|\\.zip)$", f)) || (f == ".") - -## helper function which switches to local (ie NULL) repo if matching file is presented -installArg <- function(f, lib, rep, dep, iopts, error, skipmissing, skipinstalled, ncpus, method, type) { - install_packages2(pkgs=f, - lib=lib, - repos=if (isMatchingFile(f)) NULL else rep, - dependencies=dep, - INSTALL_opts=iopts, - Ncpus = ncpus, - method = method, - type = type, - error = error, - skipmissing = skipmissing, - skipinstalled = skipinstalled) -} - -## strip out arguments to be passed to R CMD INSTALL -isArg <- grepl('^--',opt$PACKAGES) -installOpts <- opt$PACKAGES[isArg] -opt$PACKAGES <- opt$PACKAGES[!isArg] - -if (length(opt$PACKAGES)==0 && file.exists("DESCRIPTION") && file.exists("NAMESPACE")) { - ## we are in a source directory, so build it - message("* installing *source* package found in current working directory ...") - opt$PACKAGES <- "." -} - -## helper function to for existing files with matching extension -isMatchingFile <- - function(f) (file.exists(f) && - grepl("(\\.tar\\.gz|\\.tgz|\\.zip)$", f)) || (f == ".") - -## check arguments for local files -- if none, then we can pass vector on -isLocal <- sapply(opt$PACKAGES, isMatchingFile) - -## for any local sources loop explicitly as before, otherwise for remote -## packages pass vector to install_packages2 which does the rest (and -## possibly in parallel using up to ncpus) -if (any(isLocal)) { - sapply(opt$PACKAGES, installArg, opt$libloc, opt$repos, opt$deps, - installOpts, opt$error, opt$skipmissing, opt$skipinstalled, opt$ncpus, opt$method, opt$type) -} else { - install_packages2(pkgs = opt$PACKAGES, - lib = opt$libloc, - repos = opt$repos, - dependencies = opt$deps, - INSTALL_opts = installOpts, - Ncpus = opt$ncpus, - method = opt$method, - type = opt$type, - error = opt$error, - skipmissing = opt$skipmissing, - skipinstalled = opt$skipinstalled) -} - -## clean up any temp file containing CRAN directory information -sapply(list.files(path=tempdir(), pattern="^(repos|libloc).*\\.rds$", full.names=TRUE), unlink) \ No newline at end of file diff --git a/base_images/2i2c/r-base/scripts/install_cran_packages_r.sh b/base_images/2i2c/r-base/scripts/install_cran_packages_r.sh index 160ef4b..01c7d59 100644 --- a/base_images/2i2c/r-base/scripts/install_cran_packages_r.sh +++ b/base_images/2i2c/r-base/scripts/install_cran_packages_r.sh @@ -5,51 +5,43 @@ set -e export DEBIAN_FRONTEND=noninteractive ## build ARGs -NCPUS=${NCPUS:--1} R_LIB=${R_LIB:-/usr/local/lib/R/site-library} -# Install recommended R packages first to avoid warnings -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "codetools" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "tmap" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "tidyterra" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "BIOMASS" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "nlraa" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "geojsonio" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "future" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://r-lidar.r-universe.dev" -n "$NCPUS" "lasR" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "partykit" -# Random fields is deprecated as of 2022 -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "randomForest" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "RCSF" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "RPostgreSQL" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "car" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "chron" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "egg" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "ggpubr" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "ggspatial" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "ggtext" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "gsubfn" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "microbenchmark" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "minpack.lm" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "patchwork" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "paws" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "pool" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "proto" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "protolite" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "rgee" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "rlist" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "rnaturalearth" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "rockchalk" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "RODBC" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "rstac" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "RStoolbox" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "snow" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "sqldf" -Rscript /scripts/install2.r --error --skipmissing --skipinstalled -l "$R_LIB" -r "https://cran.r-project.org" -n "$NCPUS" "duckdb" +# Install CRAN packages using pak (much faster with pre-built binaries) +# pak automatically handles parallel downloads and dependency resolution +Rscript -e "pak::pak(c( + 'tidyterra', + 'BIOMASS', + 'nlraa', + 'geojsonio', + 'partykit', + 'randomForest', + 'RCSF', + 'RPostgreSQL', + 'car', + 'chron', + 'egg', + 'ggpubr', + 'ggtext', + 'gsubfn', + 'microbenchmark', + 'minpack.lm', + 'patchwork', + 'paws', + 'pool', + 'proto', + 'protolite', + 'rgee', + 'rlist', + 'rockchalk', + 'RODBC', + 'RStoolbox', + 'snow', + 'sqldf' +), lib = '$R_LIB', ask = FALSE)" -# Install Bioconductor packages -# BiocManager must be installed first, then use it to install Bioconductor packages -Rscript -e "BiocManager::install('rhdf5', lib = '$R_LIB', Ncpus = $NCPUS, update = FALSE, ask = FALSE)" +# Install lasR from r-universe (pak supports alternative repos) +Rscript -e "pak::pak('r-lidar/lasR', lib = '$R_LIB', ask = FALSE)" # Clean up rm -rf /var/lib/apt/lists/* diff --git a/base_images/2i2c/r-base/scripts/print_package_versions.R b/base_images/2i2c/r-base/scripts/print_package_versions.R deleted file mode 100644 index 2d1bb43..0000000 --- a/base_images/2i2c/r-base/scripts/print_package_versions.R +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env Rscript - -# Script to print all R packages defined in install_cran_packages_r.sh -# along with their current versions - -cat("R Package Versions\n") -cat("==================\n\n") - -# Read the install script -script_path <- "/scripts/install_cran_packages_r.sh" -if (!file.exists(script_path)) { - # If running locally, try the relative path - script_path <- "install_cran_packages_r.sh" -} - -# Read the script content -script_lines <- readLines(script_path) - -# Extract package names from Rscript install2.r lines -packages <- c() - -for (line in script_lines) { - # Match lines with install2.r and extract package name (last quoted argument) - if (grepl("install2\\.r.*\"[^\"]+\"\\s*$", line)) { - # Extract the last quoted string - match <- regmatches(line, regexpr("\"([^\"]+)\"\\s*$", line)) - if (length(match) > 0) { - package_name <- gsub("\"", "", match) - packages <- c(packages, package_name) - } - } - - # Also match Bioconductor packages from BiocManager::install - if (grepl("BiocManager::install\\('([^']+)'", line)) { - match <- regmatches(line, regexpr("'([^']+)'", line)) - if (length(match) > 0) { - package_name <- gsub("'", "", match) - packages <- c(packages, package_name) - } - } -} - -# Get versions for each package -cat(sprintf("Found %d packages\n\n", length(packages))) - -for (pkg in packages) { - tryCatch({ - version <- as.character(packageVersion(pkg)) - cat(sprintf("%-20s %s\n", pkg, version)) - }, error = function(e) { - cat(sprintf("%-20s NOT INSTALLED\n", pkg)) - }) -} - -cat("\n") diff --git a/base_images/2i2c/r-base/scripts/r_package_versions.txt b/base_images/2i2c/r-base/scripts/r_package_versions.txt deleted file mode 100644 index 35f5464..0000000 --- a/base_images/2i2c/r-base/scripts/r_package_versions.txt +++ /dev/null @@ -1,45 +0,0 @@ -Since it is difficult to pin the version for R packages because once the current package we have pinned goes -into the archives because a new package was released, the link like https://cran.r-project.org/src/contrib/codetools_0.2-20.tar.gz -will break because archive needs to be added to the url for that version -To avoid constantly having to update these links, I propose we just record the package versions for our R packages -in this text file in case we need to reference them later -The R script called print_package_versions.R will generate a list of all R package versions for the R packages we are installing in install_cran_packages_r.sh - -Release 5.0: -codetools 0.2.20 -tidyterra 0.7.2 -BIOMASS 2.2.4.1 -nlraa 1.9.10 -essentials 0.1.0 -geojsonio 0.11.3 -future 1.68.0 -lasR 0.17.3 -partykit 1.2.24 -randomForest 4.7.1.2 -RCSF 1.0.2 -RPostgreSQL 0.7.8 -car 3.1.3 -chron 2.3.62 -egg 0.4.5 -ggpubr 0.6.2 -ggspatial 1.1.10 -ggtext 0.1.2 -gsubfn 0.7 -microbenchmark 1.5.0 -minpack.lm 1.2.4 -patchwork 1.3.2 -paws 0.9.0 -pool 1.0.4 -proto 1.0.0 -protolite 2.3.1 -rgee 1.1.8 -rlist 0.4.6.2 -rnaturalearth 1.0.1 -rockchalk 1.8.157 -RODBC 1.3.26 -rstac 1.0.1 -RStoolbox 1.0.2.1 -snow 0.4.4 -sqldf 0.4.11 -duckdb 1.2.1 -rhdf5 2.50.2 \ No newline at end of file diff --git a/base_images/2i2c/r/docker/Dockerfile b/base_images/2i2c/r/docker/Dockerfile index ace3c7a..1f354fd 100644 --- a/base_images/2i2c/r/docker/Dockerfile +++ b/base_images/2i2c/r/docker/Dockerfile @@ -1,5 +1,4 @@ -ARG BASE_IMAGE -FROM ${BASE_IMAGE} +FROM mas.dit.maap-project.org/root/maap-workspaces/2i2c/r-base:pak ENV LANG=en_US.UTF-8 ENV TZ=US/Pacific ARG DEBIAN_FRONTEND=noninteractive @@ -18,4 +17,12 @@ RUN conda init ARG IMAGE_REF ENV DOCKERIMAGE_PATH_BASE_IMAGE=${IMAGE_REF} ARG DEFAULT_DOCKERFILE_PATH -ENV DOCKERIMAGE_PATH_DEFAULT=${DEFAULT_DOCKERFILE_PATH} \ No newline at end of file +ENV DOCKERIMAGE_PATH_DEFAULT=${DEFAULT_DOCKERFILE_PATH} + +USER root +COPY scripts/init-user.sh /usr/local/bin/init-user.sh +RUN chmod +x /usr/local/bin/init-user.sh +USER ${NB_USER} + +# This script returns control to base image's /srv/start after +ENTRYPOINT ["/usr/local/bin/init-user.sh"] \ No newline at end of file diff --git a/base_images/2i2c/r/environment.yml b/base_images/2i2c/r/environment.yml index 463c083..08b7729 100644 --- a/base_images/2i2c/r/environment.yml +++ b/base_images/2i2c/r/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - nodefaults dependencies: - - pip=26.0 + - pip=26.1.1 - pip: - maap-py==4.2.0 - maap-algorithms-jupyter-extension==0.5.1 diff --git a/base_images/2i2c/r/scripts/init-user.sh b/base_images/2i2c/r/scripts/init-user.sh new file mode 100644 index 0000000..c8c5bc4 --- /dev/null +++ b/base_images/2i2c/r/scripts/init-user.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +REGION="${AWS_DEFAULT_REGION:-us-west-2}" + +rclone config create maap-s3 s3 provider=AWS env_auth=true region="$REGION" no_check_bucket true + +exec /srv/start "$@" \ No newline at end of file diff --git a/base_images/2i2c/tensorflow2/docker/Dockerfile b/base_images/2i2c/tensorflow2/docker/Dockerfile index 4fd574d..7ba9def 100644 --- a/base_images/2i2c/tensorflow2/docker/Dockerfile +++ b/base_images/2i2c/tensorflow2/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/pangeo/ml-notebook:2025.12.30 +FROM quay.io/pangeo/ml-notebook:2026.04.29 ENV LANG=en_US.UTF-8 ENV TZ=US/Pacific ARG DEBIAN_FRONTEND=noninteractive @@ -10,6 +10,4 @@ RUN conda env update -n ${CONDA_ENV} -f "/tmp/environment.yml" \ && find ${CONDA_DIR}/ -follow -type f -name '*.js.map' -delete \ && ${CONDA_DIR}/bin/conda clean -afy -RUN conda init - -RUN jupyter server extension enable maap_jupyter_server_extension \ No newline at end of file +RUN conda init \ No newline at end of file diff --git a/base_images/2i2c/tensorflow2/environment.yml b/base_images/2i2c/tensorflow2/environment.yml index afac672..da2b82d 100644 --- a/base_images/2i2c/tensorflow2/environment.yml +++ b/base_images/2i2c/tensorflow2/environment.yml @@ -6,7 +6,7 @@ dependencies: # Dependencies for VS Code IDE - code-server>=3.2 - jupyter-vscode-proxy=0.7 - - pre_commit=3.4.0 + - pre_commit # Upgrade from ml notebook image - earthaccess>=0.16.0 # Pin down to avoid https://github.com/holoviz/pyviz_comms/issues/143