Manage R project dependencies with Pixi
rpix lets you use Pixi from R. Pixi installs R itself, R packages and the system libraries they need (such as GDAL) from conda-forge into an environment inside your project. It records the exact versions in a lock file, so the project runs the same on every computer.
Install rpix in the R you normally use, then let it install Pixi:
install.packages(
"rpix",
repos = c("https://roaldarbol.r-universe.dev", "https://cloud.r-project.org")
)
rpix::install_pixi()
Set up the project in the working directory, for your IDE. This creates a Pixi project, adds R and rpix to it, and points the IDE at that R. Until rpix is on conda-forge, it comes from the rpix-forge channel, which is added to the project after conda-forge:
rpix::use_pixi(ide = "positron") # or "rstudio", or "vscode"
From then on, work in R started by Pixi: in your IDE (see Using rpix
with an IDE), or with
pixi run R in a terminal in the project folder. Add and remove
packages from there:
library(rpix)
pixi_add(c("dplyr", "ggplot2"))
pixi_add("bioc::DESeq2")
pixi_remove("ggplot2")
A package that isn’t on conda-forge or bioconda can be built from source, which pixi_add() offers. Together, that’s 80% of CRAN and nearly all of Bioconductor.
pixi_sitrep() checks the setup, and suggests fixes if something’s off.
To start a new project from a template instead, see r-template.
rpix comes with an agent skill, so coding agents such as Claude Code, Codex and Cursor add packages through Pixi, run the project’s R, and start from pixi_sitrep() when something’s off. In Claude Code:
/plugin marketplace add roaldarbol/rpix
/plugin install rpix@rpix
For other agents that read Agent Skills, copy the skills/rpix folder to where they look for skills.
Ask questions and share ideas in GitHub Discussions, and report bugs in the issues. For Pixi itself, ask on the Discord of prefix.dev, the makers of Pixi.
Fun fact: rpix is inspired by the Danish word harpiks, which means resin. I see it as the resin that binds Pixi into the natural R workflow.