Terminal command in terminal pane Vs. r code with system()

I have an rscript that communicates with an mlflow server. In order for my script to run successfully, I must run the following terminal command before communicating with the mlflow R api:

conda activate r-mlflow-1.17.0; pip3 install boto3"

From within rstudio in the terminal pane, when I paste this, there's no complaints and everything works. I wanted to do the equivalent from the top of my script so that I wouldn't forget. But, when I do this equivilent from within R I get:

system("conda activate r-mlflow-1.17.0; pip3 install boto3")
sh: 1: conda: not found
sh: 1: pip3: not found
error in running command

Why does this line of code work directly in the terminal pane in rstudio but not from within R using the system() fucntion?

Or, is there an equivalent way to tell r to use r-mlflow-1.17.0 and to install boto3, e.g. with reticulate?

Once the library has been installed there is no need to install it again every time you run the script, at most you just need to activate the conda environment, you can do it from R with reticulate::use_condaenv() or with your system command you should only use conda activate r-mlflow-1.17.0

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.