FIX: undesired python version used for reticulate when working with radian #508
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.
problem
When using Radian IDE, which default used python version may differ from the selected one, reticulate will force the use of the python version used for radian instead of the one provided by
RETICULATE_PYTHON
. The proposed solution is to fetch the radian matching the desired python version for reticulate.the rix configuration (minimal)
here is an almost minimal setup to reproduce the error:
the following code is then executed inside the nix environment
collision between radian's python version and reticulate's python version
When entering
nix-shell
while usingradian
IDE,reticulate
automatically falls back to the python version used byradian
, as we can see in the following example:(note that
RETICULATE_PYTHON
switches from the correct desired version to radian's one on loading thereticulate
package)only when using radian
However, it still works perfectly fine when using
Rscript
:proposed solution
The proposed solution is to match radian's python version with the python version from the user-defined config within the override of
radianWrapper
:the code produces the following
default.nix
:running the
nix-shell
now produces the desired result as "forced by the current process":(notice that the
RETICULATE_PYTHON
does not change here)if no
py_conf
is provided, then we do not add the python version override:note that I don't know how to properly remove the added newline when there is no
py_conf
without using a if/else statement, so any suggestion is much appreciatedsuggested edits
(+) function: set_radian_python_version_override
(~) generate_wrapped_pkgs
py_conf
andflag_py_conf
as argumentsTODO: remove whitespaces and empty line when there is no py_conf
(I don't know how to do)
potential edge case
the desired python version is much older than the one used for radian