Open sneumann opened 1 day ago
Just for completeness: I compared the environment variables, found two that sound like python/reticulate used a fresh container, removed 'em, to no avail.
unset VIRTUAL_ENV
unset RETICULATE_AUTOCONFIGURE
R -e 'install.packages("reticulate"); remotes::install_github("rstudio/tensorflow", upgrade="never"); library(tensorflow); install.packages("keras"); library(keras); install_keras(); model.sla <- keras_model_sequential(input_shape = c(NULL, 12906, 1))'
@sneumann Cross references:
So, while not a solution, the workaround is to
## Does not work:
R -e 'tensorflow::as_tensor("Hello World")' ;
## Workaround:
R -e 'reticulate::use_virtualenv("/root/.virtualenvs/r-tensorflow", required = TRUE); library(tensorflow); tensorflow::as_tensor("Hello World")'
I'm sorry, but I couldn't figure out what bug in this was caused by this repository. Assuming this is a bug, isn't it a bug in your installation of the R package?
So, as I have a workaround, this is not urgent. But as installation worked on rocker/rstudio
from a few months back, and does not work in current rocker/ml
, it is a bit of a regression.
I can't put my finger in it, but something is changing/messing up the https://rstudio.github.io/reticulate/articles/versions.html#order-of-discovery of the virtual environment from what users like me were used to.
Yours,
Steffen
Container image name
rocker/ml:latest
Container image digest
rocker/ml@sha256:327295f35a097a7ee2fec46804e0a285057c9918df1e4e12470e915e29e7de40
What operating system are you seeing the problem on?
Linux
System information
Docker version 24.0.7-ce, build 311b9ff0aa93
onopenSUSE VERSION = 15.5
Bug description
Hi, I am installing keras/tensorflow in
rocker/ml
. Installation runs fine, From python I can activate the venv/root/.virtualenvs/r-tensorflow
and python can import tensorflow, and even shows some GPUs. Issue happens when usinglibrary(tensorflow)
, becauseModuleNotFoundError: No module named 'tensorflow'
.On an older rocker/rstudio based container with R-4.4.1 I get
while the non-working
rocker/ml
also installed into/root/.virtualenvs/r-tensorflow
but a different python venv
/opt/venv/
is used when I then want to load the library:=> How to inform reticulate/tensorflow to use the correct venv ? I upgraded
reticulate
from 1.37 -> 1.40 which is the one in the working installation, same error. Both images are based on 22.04, both use python 3.10.12.Yours, Steffen
How to reproduce this bug?
Full build log:
Broken
rocker/ml
installation:Working (older)
rocker/rstudio
-based installation: