rstudio / rstudio/reticulate

conda_list() does not list my environments

Open
#613 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.8k
Forks
349
Avg merge
5h 13m
Merged PRs (30d)
4

Description

I'm trying to get going with reticulate within my conda environments, but I cant get reticulate to find my environments. Running conda_list() without specifying my conda executable results in this output.

> conda_list()
       name                                 python
1 Anaconda3 C:\\ProgramData\\Anaconda3\\python.exe

But if I run conda env list within my cmd, I get the following:

(base) C:\>conda env list
# conda environments:
#
base                  *  C:\ProgramData\Anaconda3
dummy3                   C:\Users\rata\.conda\envs\dummy3

I thought the root of this is probably caused by reticulate using a different conda executable than what I'm using in my cmd. So I copied the output of path from cmd into R, searched all paths for conda.*-Files and ran conda_list() on each of these files. I was hoping that at least one of them would return the full list of my environments, but this does not seem to be the case. What am I doing wrong?

library(reticulate)
#> Warning: Paket 'reticulate' wurde unter R Version 3.6.1 erstellt
library(tidyverse)
#> Warning: Paket 'tidyverse' wurde unter R Version 3.6.1 erstellt
#> Warning: Paket 'dplyr' wurde unter R Version 3.6.1 erstellt


paths <- "C:/ProgramData/Anaconda3;C:/ProgramData/Anaconda3/Library/mingw-w64/bin;C:/ProgramData/Anaconda3/Library/usr/bin;C:/ProgramData/Anaconda3/Library/bin;C:/ProgramData/Anaconda3/Scripts;C:/ProgramData/Anaconda3/bin;C:/ProgramData/Anaconda3/condabin;C:/Program Files/Python36/Scripts/;C:/Program Files/Python36/;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;C:/WINDOWS/System32/WindowsPowerShell/v1.0/;C:/WINDOWS/System32/OpenSSH/;C:/Program Files/Git/cmd;C:/Program Files/FME/;C:/Program Files (x86)/Sennheiser/SoftphoneSDK/;C:/Users/rata/AppData/Local/Microsoft/WindowsApps;C:/Users/rata/AppData/Roaming/TinyTeX/bin/win32"


paths <- strsplit(paths,";")[[1]]

paths_conda <- map(paths,function(x){
  fil <- list.files(x,full.names = F)
  fil <- fil[grepl("conda\\.",fil,ignore.case = FALSE)]
  if(length(fil)>0){list(paste(x,fil,sep = "/"))}
}) 


paths_conda <- paths_conda[lengths(paths_conda)>0] 

paths_conda <- unlist(paths_conda)

paths_conda
#> [1] "C:/ProgramData/Anaconda3/Library/bin/conda.bat"
#> [2] "C:/ProgramData/Anaconda3/Scripts/anaconda.exe" 
#> [3] "C:/ProgramData/Anaconda3/Scripts/conda.exe"    
#> [4] "C:/ProgramData/Anaconda3/condabin/conda.bat"


map_dfr(paths_conda,~conda_list(.x))
#>        name                                 python
#> 1 Anaconda3 C:\\ProgramData\\Anaconda3\\python.exe
#> 2 Anaconda3 C:\\ProgramData\\Anaconda3\\python.exe
#> 3 Anaconda3 C:\\ProgramData\\Anaconda3\\python.exe

Created on 2019-10-21 by the reprex package (v0.3.0)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported difference between reticulate's conda_list() and the command-line conda env list on Windows. Inspect the conda_list() entry point and compare the environments each command discovers. Done means conda_list() includes the dummy3 environment shown by conda env list.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, r
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.