Replies: 1 comment 1 reply
-
|
As someone who continues to do mostly "bare metal" PEcAn installs, and has watched many a student spend their entire first week on a project to just getting PEcAn installed and running, I really like the idea of a build system that makes that easier (8 min would be amazing). That said, the need for new PEcAn developers to learn all of our system-specific tools/hacks (building documentation, updating the Docker dependencies, updating the build log files, etc) is already challenging and I'd hate to create another thing that people need to keep up-to-date. Is there a way for these scripts to be more integrated with things like docker/depends/pecan_package_dependencies.csv for building it's list of packages to install on-the-fly instead of being hard coded? Also, for those of us operating on a HPC, is there a way to get pixi to NOT install duplicate copies of things that are already in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pixi is a great cross-platform dependency manager, from the author of
mamba(which in turn is an improved version ofconda). Pixi pulls packages fromconda-forge, so it has a pretty solid collection of R packages and scientific libraries (NetCDF, HDF5, GDAL, etc.).A major advantage of pixi is that, like conda/mamba, it tracks both R packages and their system dependencies. So, e.g.,
pixi add r-ncdf4will automatically pull in NetCDF4 and HDF5 dependencies; similarly,r-sfwill implicitly pull GDAL, Proj, etc.Similarly to
renv, pixi manages dependencies with two files:pixi.toml(which provides project metadata and defines overall package constraints (e.g.,R = ">=4.0";r-roxygen2 = "==7.3.2") and a machine-generatedpixi.lockfile that contains a complete list of the "solved" environment (including all mutual version constraints) and its precise version and origin. The general workflow is that you "re-solve" the lockfile periodically whenever you want to update packages to the latest combination of mutually supported versions, but for day-to-day usage, you pull packages from the lockfile and are guaranteed to have an identical installation. Typically, bothpixi.tomlandpixi.lockare added to version control.Like
renv, pixi accomplishes this by maintaining a complete copy of your project library in the.pixifolder in the project root. Note that this includes a full installation of R itself and its dependencies (gfortran, etc.), which gives you a very strong reproducibility guarantee.After a bit of iteration, here's a
pixi.tomlfile that should work for PEcAn on x86-64 Linux systems (I've left almost all versions constrained, but we can add those constraints if needed). The dependencies here are pulled from the PEcAn package DESCRIPTION files (minus packages that are not available through conda-forge --- we still have to install those by hand).We can add additional platform support by modifying the
platformfield, but then we lose some conda-forge packages that aren't supported on those systems (e.g.,duckdb, a dependency ofneonstore, andtaxize, a dependency oftraits, don't t have workingosx-arm64(M-series Mac) builds;jagsdoesn't have a Windows build). That may be worthwhile to make it easier to do PEcAn development locally, at least on MacOS; something to consider.Note also that pixi has a convenient "task" system for defining specific commands to run in the environment. For example, with the config below, a complete PEcAn install is just:
That will first make sure the entire environment is installed, then run the
install_ghtask to grab amerifluxr from GitHub, and then install PEcAn and remaining (non-conda) package dependencies.Combining pixi + pak (for R package installation; pak is clever and aggressive about parallel build and install, which helps it go fast), I was able to get a complete PEcAn.all + PEcAn.SIPNET installation in around 8 minutes on my local machine (12 cores; ~6 GB RAM; WSL2 in Windows 11). The resulting
.pixifolder is ~2.7 GB.It may be possible to combine pixi with renv for complete reproducibility (by using renv to track non-conda-forge packages), but I haven't tried.
Details
Here's a quick R script to build this
pixi.tomlfile from the PEcAn package DESCRIPTIONs.Details
I'm not sure this replaces Singularity/Apptainer/Docker for portability, but I find this way of working somewhat more convenient, especially for development workflows. I've been actively using pixi for lots of Python and R projects and I find it's incredibly effective for eliminating the headache of moving development around between operating systems.
Food for thought!
Beta Was this translation helpful? Give feedback.
All reactions