0

Take two simple commands executed in an Rmd file.

  • pwd works fine
  • but when I try to run conda list I get an error that conda: command not found, even though conda list executes fine in my terminal.
```{bash}
pwd
```
```{bash}
conda list
```

What would be the process to make conda findable in an Rmd chunk?

enter image description here

Joe
  • 2,735
  • 1
  • 15
  • 34
  • The symptoms suggest that you have a different `PATH` in the environment where it doesn't work, but your question doesn't contain any details about why or how it's different. We have a ton of `PATH` troubleshooting questions so I'm simply voting to close this as lacking debugging details and/or search effort. Starting your R environment from a place where the `PATH` is correct is probably the simplest immediate workaround. – tripleee May 31 '22 at 17:15
  • Try adding a full path to `conda` exe – GoinOff May 31 '22 at 17:27
  • 1
    @GoinOff adding the full path was successful. Thank you. /Users/jpowers4/miniconda3/bin/conda list – Joe May 31 '22 at 17:30
  • Possible duplicate of https://stackoverflow.com/questions/135688/setting-environment-variables-on-os-x – tripleee Jun 01 '22 at 03:16

1 Answers1

0

This issue can be solved in two ways both alluded to in comments:

  1. Adding the full path to conda

    /Users/jpowers4/miniconda3/bin/conda list
    
  2. Adding the "full path to conda" to my PATH variable in R

    old_path <- Sys.getenv("PATH")
    
    Sys.setenv(PATH = paste(old_path, "/Users/jpowers4/miniconda3/bin/", sep = ":"))
    

    Then conda list will execute

    conda list
    
John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Joe
  • 2,735
  • 1
  • 15
  • 34