-
Notifications
You must be signed in to change notification settings - Fork 318
Description
[thanks @t-kalinowski for your response, I was since editing my issue and adding the workaround]
Hi,
I am installing (and testing) tensorflow using
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))'
This works nicely in an older rocker/rstudio image based on Ubuntu22.04.4, with R-python 3.10.12, R-4.4.1
This fails on the rocker/ml images based on Ubuntu22.04.3 with nvidia cuda stuff installed, also with R-python 3.10.12 and R-4.4.1
I have rocker-org/rocker-versioned2#880 as initially I thought that would be a rocker/ml issue.
I have a workaround now to install as shown above, and for usage
## 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")'
So all left now is possibly to add your suggestions to https://tensorflow.rstudio.com/install/
I also leave below my output from debugging. I was curious about the error for tf_config(),
this comes because python_version can be print()ed, but not cat()ed.
Yours,
Steffen
> reticulate::py_config()
python: /root/.virtualenvs/r-tensorflow/bin/python
libpython: /usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.so
pythonhome: /root/.virtualenvs/r-tensorflow:/root/.virtualenvs/r-tensorflow
version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
numpy: /root/.virtualenvs/r-tensorflow/lib/python3.10/site-packages/numpy
numpy_version: 1.26.4# R -e 'reticulate::use_virtualenv("/root/.virtualenvs/r-tensorflow", required = TRUE); library(tensorflow); tensorflow::tf_config()'
> tensorflow::tf_config()
TensorFlow v2.15.1 ()
Python vError in cat("Python v", x$python_version, " (", aliased(x$python), ")\n", :
argument 2 (type 'list') cannot be handled by 'cat'
Digging into the tf_config() error above:
> cat(tensorflow::tf_config()$python_version)
Error in cat(tensorflow::tf_config()$python_version) :
argument 1 (type 'list') cannot be handled by 'cat'
> print(tensorflow::tf_config()$python_version)
[1] ‘3.10’
> str(tensorflow::tf_config()$python_version)
Classes 'package_version', 'numeric_version' hidden list of 1
$ : int [1:2] 3 10