I have the following existing Python environments:
$ conda info --envs
base * /home/ubuntu/anaconda3
tensorflow2_latest_p37 /home/ubuntu/anaconda3/envs/tensorflow2_latest_p37
What I want to do is to activate tensorflow2_latest_p37
environment and use it in R code. I tried the following code:
library(reticulate)
use_condaenv( "tensorflow2_latest_p37")
library(tensorflow)
tf$constant("Hello Tensorflow!")
But it failed to recognize the environment:
> library(reticulate)
> use_condaenv( "tensorflow2_latest_p37")
/tmp/RtmpAs9fYG/file41912f80e49f.sh: 3: /home/ubuntu/anaconda3/envs/tensorflow2_latest_p37/etc/conda/activate.d/00_activate.sh: Bad substitution
Error in Sys.setenv(PATH = new_path) : wrong length for argument
In addition: Warning message:
In system2(Sys.which("sh"), fi, stdout = if (identical(intern, FALSE)) "" else intern) :
running command ''/bin/sh' /tmp/RtmpAs9fYG/file41912f80e49f.sh' had status 2
What is the right way to do it?
from How to activate existing Python environment with R reticulate
No comments:
Post a Comment