Open krivard opened 2 years ago
Things that didn't work:
reticulate.conda_binary
use_condaenv
use_miniconda
use_python
For future travelers: I got this working in the meantime by switching to mambaforge, which seems to generate the expected content in the history file:
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
activate-environment: www-main
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
use-only-tar-bz2: true # (for caching support)
- name: Update environment
run: mamba env update -n www-main -f environment.yml
It would still be nice if reticulate made more consistent assumptions though -- if I use the provided hint functions, it shouldn't still try to locate conda through python_info_condaenv_find
.
It would still be nice if reticulate made more consistent assumptions though -- if I use the provided hint functions, it shouldn't still try to locate conda through python_info_condaenv_find.
Thanks for the diagnosis! I agree; we should definitely be reading + respecting these. Presumedly, we could check reticulate.conda_binary
first here: https://github.com/rstudio/reticulate/blob/a1d7f7f573f652212bc2c72c39317340e6d8b511/R/python-tools.R#L148-L166
@kevinushey @t-kalinowski I've been running into this same issue with the rworkflows
action. Just wondering, has a fixed been pushed to CRAN yet?
In my case, I noticed that reticulate wasn't recognizing that conda was installed when running the conda_create
function:
My lab has a project which uses GitHub Actions to build a blog from Rmarkdown files. Some of the source files include Python segments, which get built with reticulate. The last successful build was May 23, then we had a long quiet period before needing to build the blog again a couple of weeks ago. That build failed with:
I've assembled a reproducible example in a dedicated GitHub repo(and here's the workflow YAML as a static file in case that repo rots), but I have not been able to replicate this particular environment quirk in a system I can actually shell into, so unfortunately debugging is likely to be slow going.
I have managed to partially trace the problem to
reticulate:::python_info_condaenv_find
, which uses a more general regex to fetch lines from the history file than the one it uses to parse that line:https://github.com/rstudio/reticulate/blob/a1d7f7f573f652212bc2c72c39317340e6d8b511/R/python-tools.R#L176-L182
For some reason, the system resulting from running
conda-incubator/setup-miniconda@v2
onubuntu-latest
results in a history file where the firstcmd
line is amamba update
, not acreate
. Thesub
function atpython_info_condaenv_find:182
thus substitutes nothing and passes the history line tonormalizePath
wholesale, causing the above misbehavior.It also looks like there is no
create
line in my conda history file(screenshot below), so fixing the regex will only go so far. I've tried a bunch of other ways to tell reticulate how to configure itself for this environment but haven't found one that works yet. Any tips?