Disable reticulate auto-configuration in Nix-based interop derivations#71
Closed
Disable reticulate auto-configuration in Nix-based interop derivations#71
Conversation
Copilot
AI
changed the title
[WIP] Fix PYTHONPATH issue in rixpress due to reticulate update
Disable reticulate autoconfigure in rixpress derivations
Feb 4, 2026
Copilot
AI
changed the title
Disable reticulate autoconfigure in rixpress derivations
Disable reticulate autoconfigure in interop derivations
Feb 4, 2026
Co-authored-by: b-rodrigues <2998834+b-rodrigues@users.noreply.github.com>
Co-authored-by: b-rodrigues <2998834+b-rodrigues@users.noreply.github.com>
Copilot
AI
changed the title
Disable reticulate autoconfigure in interop derivations
Disable reticulate auto-configuration in Nix-based interop derivations
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reticulate 1.36.0 now auto-configures
PYTHONPATH, which breaks rixpress’s hermetic Nix builds and causes import errors in Python↔R transfers. rixpress should always opt out of this auto-configuration while still allowing explicit overrides.RETICULATE_AUTOCONFIGURE=0into py2r/r2py derivations, with user-suppliedenv_vartaking precedence.env_vartorxp_py2r()/rxp_r2py()and document the default behavior.Original prompt
Implementation Guide: Always Set RETICULATE_AUTOCONFIGURE=0 in rixpress
Problem Statement
Starting with reticulate version 1.36.0, the package automatically sets
PYTHONPATHbefore loading Python to ensure modules are looked up in standard locations. While this helps in typical environments, it breaks rixpress's hermetic Nix builds.The Breaking Change (reticulate 1.36.0)
From the reticulate changelog:
Why This Breaks rixpress
Nix's Custom Directory Structure: Nix stores each package in isolated paths like
/nix/store/<hash>-python3.12-numpy-2.2.0/lib/python3.12/site-packagesPre-configured PYTHONPATH: Nix carefully constructs
PYTHONPATHwith all dependencies:Reticulate's Auto-configuration Conflicts: When reticulate tries to "help" by resetting/modifying
PYTHONPATH, it can:Hermetic Builds: Each rixpress derivation runs in an isolated sandbox, so interactive shell environment variables don't propagate
The Error Manifestation
Proposed Solution
Always set
RETICULATE_AUTOCONFIGURE=0in any rixpress derivation that uses reticulate.This tells reticulate to leave the Python configuration alone and trust that the environment is already correctly configured (which it is, by Nix).
Implementation Requirements
Functions That Need
RETICULATE_AUTOCONFIGURE=0rxp_py2r()- Usesreticulate::py_load_object()rxp_r2py()- Usesreticulate::py_save_object()rxp_r()withenv_varparameterrxp_qmd()/rxp_rmd()withenv_varparameterAlways Set Internally (Recommended)
Pros:
env_varparameterFile:
R/rxp_file.R1. Update
rxp_common_setup()2. Update
build_reticulate_phase()3. Update function signatures (future enhancement)