I want to run a system command in a conda environment, but I can't figure out how to get R to send the command to a properly initialized bash shell. I tried system('conda activate myenv && mycommand')
, but I get a warning about needing to run conda init bash
. Trying system('conda init bash && conda activate myenv')
throws the same error. Making bash
the first command freezes RStudio, e.g. system('bash && ....
)`.
Is there any way to send a system command in R that would run AFTER sourcing my .bashrc file?
for anaconda 4 : bashrc and then copy the path into the file and save it after that you activate the changes using source . bashrc. When I type export PATH=~/anaconda3/bin:$PATH into the terminal and then run conda --version it works fine.
If you face the 'conda command not found' error, the first and most common solution is to ensure you have conda installed. You can install conda using either the anaconda or miniconda packages. In this tutorial, we will use the anaconda installer.
Use Conda Run.
system('conda run -n myenv mycommand')
See conda run --help
for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With