Open arkadi-aigora opened 2 years ago
Hi @arkadi-aigora. I'm a bit short on time for the next few weeks, but I'll do my best to help you out.
It looks like reticulate
calls Python by using conda run
. However, conda run
does not work in read-only environments. When a Lambda container is running in AWS the only write-able directory is /tmp
.
Fortunately, it looks like there's a recent patch for this issue in conda that was merged only 8 days ago. I don't know how miniconda updates work, but is it possible to use this latest version somehow?
I also recommend setting ENV TMPDIR /tmp
in your Dockerfile. The above patch appears to use this.
@arkadi-aigora I recently solved some configuration issues with R + conda + reticulate. I can't comment too much on the exact issue you dealt with, however, I can show the steps I used in case that might be helpful to you or anyone else in the future.
First, I installed conda using the system package manager in my Dockerfile.
# Import our GPG public key
RUN rpm --import https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc
# Add the Anaconda repository
RUN cat <<EOF > /etc/yum.repos.d/conda.repo
[conda]
name=Conda
baseurl=https://repo.anaconda.com/pkgs/misc/rpmrepo/conda
enabled=1
gpgcheck=1
gpgkey=https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc
EOF
# Install Anaconda
RUN yum -y install conda
# Add Anaconda to path
ENV PATH="${PATH}:/opt/conda/bin/"
Then, you can run conda_create
in the Docker build to create a conda environment.
RUN Rscript -e "reticulate::conda_create('my-conda-env')"
Finally, in your R functions that use reticulate
, use reticulate::use_condaenv
to access your conda environment.
Thanks for the awesome package, @mdneuzerling !
See the code in the repo
I am able to deploy the image locally using the following commands
And when testing locally in the console with CURL
I get well a response of 6 calculated by
x = reticulate::py_eval('1+2+3')
When the image is pushed to ERC and then deployed on lambda I get an error, below is the log
Is there a chance this could be resolved?