Keras @ Error: Python module tensorflow.keras was not found.

Hello,
I just paid for the membership for RStudio Cloud, and the same error happened for Keras.

Here is the local version RStudio problem for this. It is same.
https://forum.posit.co/t/keras-running-error/93005/2

I don't know if you guys can have a look at my running history.
My RStudio account is 15903958811@139.com

Now if I run model <- keras_model_sequential()
It will say

Error: Python module tensorflow.keras was not found.

Detected Python configuration:

python:         /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome:     /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate:/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate
version:        3.6.12 |Anaconda, Inc.| (default, Sep  8 2020, 23:10:56)  [GCC 7.3.0]
numpy:          /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.5

It happened all same with the cloud version RStudio and local, all I want is just running the CNN in R.
It is so hard.
May someone help me, please?

Hello,
I got some problem for keras in R. But tensorflow is running well in python.
When I use
model <- keras_model_sequential()

I got error message:
Error:
Python module tensorflow.keras was not found.

Detected Python configuration:

python: C:/Users/DELL/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython: C:/Users/DELL/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome: C:/Users/DELL/AppData/Local/r-miniconda/envs/r-reticulate
version: 3.6.12 (default, Dec 9 2020, 00:11:44) [MSC v.1916 64 bit (AMD64)]
Architecture: 64bit
numpy: C:/Users/DELL/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version: 1.19.5

Then I tried as [R keras package Error: Python module tensorflow.contrib.keras.python.keras was not found - Stack Overflow] said, tried to install tensorflow,

library(tensorflow)
install_tensorflow(package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")

but it was saying:
Collecting package metadata (current_repodata.json): ...working... failed

ProxyError: Conda cannot proceed due to an error in your proxy configuration.
Check for typos and other configuration errors in any '.netrc' file in your home directory,
any environment variables ending in '_PROXY', and any other system-wide proxy
configuration settings.

Error: installation of 'python=3.6' into environment 'C:/Users/DELL/AppData/Local/r-miniconda/envs/r-reticulate' failed [error code 1]

Then I tried to install tesorflow in Rstudio Cloud, but the installing process was killed, so I guess because of I am in the free version.

Then I tried

library(tensorflow)
use_condaenv("keras-tf", required = T)

but
Error in use_condaenv("keras-tf", required = T) :
Unable to locate conda environment 'keras-tf'.

So, how should I come to solve this problem?

Hello,
I just paid for the membership for RStudio Cloud, and the same error happened for Keras.

I don't know if you guys can have a look at my running history.
My RStudio account is 15903958811@139.com

Now if I run model <- keras_model_sequential()
It will say

Error: Python module tensorflow.keras was not found.

Detected Python configuration:

python:         /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome:     /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate:/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate
version:        3.6.12 |Anaconda, Inc.| (default, Sep  8 2020, 23:10:56)  [GCC 7.3.0]
numpy:          /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.5

It happened all same with the cloud version RStudio and local, all I want is just running the CNN in R.
It is so hard.
May someone help me, please?

Hi @azhangbojun,

Have you tried using a virtual environment instead of miniconda, as suggested in this post: Error in Installing Keras on RStudio Cloud ?

I believe the important pieces are:

library(reticulate)
library(keras)
virtualenv_create("myenv")
install_keras(method="virtualenv", envname="myenv")

Please let me know if this helps or not!

-Joshua C. Forest

Yes, I tried, but it did not work.
1.
I used

library(reticulate)
library(keras)
virtualenv_create("myenv")
install_keras(method="virtualenv", envname="myenv")

It was showing

> library(reticulate)
> library(keras)
> virtualenv_create("myenv")
virtualenv: myenv
> install_keras(method="virtualenv", envname="myenv")
Using virtual environment 'myenv' ...
Requirement already satisfied: tensorflow==2.2.0 in ./myenv/lib/python3.6/site-packages (2.2.0)
Requirement already satisfied: keras in ./myenv/lib/python3.6/site-packages (2.4.3)
Requirement already satisfied: tensorflow-hub in ./myenv/lib/python3.6/site-packages (0.11.0)
Requirement already satisfied: h5py==2.10.0 in ./myenv/lib/python3.6/site-packages (2.10.0)
Requirement already satisfied: pyyaml==3.12 in ./myenv/lib/python3.6/site-packages (3.12)
Requirement already satisfied: requests in ./myenv/lib/python3.6/site-packages (2.25.1)
Requirement already satisfied: Pillow in ./myenv/lib/python3.6/site-packages (8.1.0)
Requirement already satisfied: six in ./myenv/lib/python3.6/site-packages (from h5py==2.10.0) (1.15.0)
Requirement already satisfied: numpy>=1.7 in ./myenv/lib/python3.6/site-packages (from h5py==2.10.0) (1.19.5)
Requirement already satisfied: protobuf>=3.8.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (3.14.0)
Requirement already satisfied: wrapt>=1.11.1 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.12.1)
Requirement already satisfied: google-pasta>=0.1.8 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (0.2.0)
Requirement already satisfied: grpcio>=1.8.6 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.34.0)
Requirement already satisfied: tensorflow-estimator<2.3.0,>=2.2.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (2.2.0)
Requirement already satisfied: scipy==1.4.1 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.4.1)
Requirement already satisfied: keras-preprocessing>=1.1.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.1.2)
Requirement already satisfied: absl-py>=0.7.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (0.11.0)
Requirement already satisfied: astunparse==1.6.3 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.6.3)
Requirement already satisfied: termcolor>=1.1.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (1.1.0)
Requirement already satisfied: opt-einsum>=2.3.2 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (3.3.0)
Requirement already satisfied: wheel>=0.26 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (0.36.2)
Requirement already satisfied: tensorboard<2.3.0,>=2.2.0 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (2.2.2)
Requirement already satisfied: gast==0.3.3 in ./myenv/lib/python3.6/site-packages (from tensorflow==2.2.0) (0.3.3)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.7.0)
Requirement already satisfied: setuptools>=41.0.0 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (51.1.2)
Requirement already satisfied: markdown>=2.6.8 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.3.3)
Requirement already satisfied: google-auth<2,>=1.6.3 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.24.0)
Requirement already satisfied: werkzeug>=0.11.15 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.0.1)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in ./myenv/lib/python3.6/site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.2)
Requirement already satisfied: chardet<5,>=3.0.2 in ./myenv/lib/python3.6/site-packages (from requests) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in ./myenv/lib/python3.6/site-packages (from requests) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in ./myenv/lib/python3.6/site-packages (from requests) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./myenv/lib/python3.6/site-packages (from requests) (1.26.2)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in ./myenv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.2.0)
Requirement already satisfied: rsa<5,>=3.1.4 in ./myenv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.7)
Requirement already satisfied: pyasn1-modules>=0.2.1 in ./myenv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.2.8)
Requirement already satisfied: requests-oauthlib>=0.7.0 in ./myenv/lib/python3.6/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.3.0)
Requirement already satisfied: importlib-metadata in ./myenv/lib/python3.6/site-packages (from markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.4.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in ./myenv/lib/python3.6/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.8)
Requirement already satisfied: oauthlib>=3.0.0 in ./myenv/lib/python3.6/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Requirement already satisfied: zipp>=0.5 in ./myenv/lib/python3.6/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.4.0)
Requirement already satisfied: typing-extensions>=3.6.4 in ./myenv/lib/python3.6/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.7.4.3)

Installation complete.


Restarting R session...

Looks well but if I tried

model <- keras_model_sequential()

it was saying

> model <- keras_model_sequential()

Collecting tensorflow
  Downloading tensorflow-2.4.0-cp36-cp36m-manylinux2010_x86_64.whl (394.7 MB)
Requirement already satisfied: wheel~=0.35 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (0.36.2)
Requirement already satisfied: google-pasta~=0.2 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (0.2.0)
Requirement already satisfied: absl-py~=0.10 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (0.11.0)
Requirement already satisfied: h5py~=2.10.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (2.10.0)
Requirement already satisfied: keras-preprocessing~=1.1.2 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.1.2)
Requirement already satisfied: typing-extensions~=3.7.4 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (3.7.4.3)
Requirement already satisfied: termcolor~=1.1.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.1.0)
Requirement already satisfied: protobuf>=3.9.2 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (3.14.0)
Requirement already satisfied: wrapt~=1.12.1 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.12.1)
Requirement already satisfied: numpy~=1.19.2 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.19.5)
Requirement already satisfied: gast==0.3.3 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (0.3.3)
Requirement already satisfied: opt-einsum~=3.3.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (3.3.0)
Requirement already satisfied: grpcio~=1.32.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.32.0)
Requirement already satisfied: astunparse~=1.6.3 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.6.3)
Requirement already satisfied: six~=1.15.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorflow) (1.15.0)
Collecting flatbuffers~=1.12.0
  Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting tensorboard~=2.4
  Downloading tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
Requirement already satisfied: markdown>=2.6.8 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (3.3.3)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (0.4.2)
Requirement already satisfied: requests<3,>=2.21.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (2.25.1)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (1.7.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (1.24.0)
Requirement already satisfied: setuptools>=41.0.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (49.6.0.post20210108)
Requirement already satisfied: werkzeug>=0.11.15 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from tensorboard~=2.4->tensorflow) (1.0.1)
Requirement already satisfied: rsa<5,>=3.1.4 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard~=2.4->tensorflow) (4.7)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard~=2.4->tensorflow) (4.2.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard~=2.4->tensorflow) (0.2.8)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.4->tensorflow) (1.3.0)
Requirement already satisfied: importlib-metadata in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from markdown>=2.6.8->tensorboard~=2.4->tensorflow) (3.4.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard~=2.4->tensorflow) (0.4.8)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (4.0.0)
Requirement already satisfied: idna<3,>=2.5 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (2020.12.5)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow) (1.26.2)
Requirement already satisfied: oauthlib>=3.0.0 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.4->tensorflow) (3.1.0)
Collecting tensorflow-estimator<2.5.0,>=2.4.0rc0
  Downloading tensorflow_estimator-2.4.0-py2.py3-none-any.whl (462 kB)
Requirement already satisfied: zipp>=0.5 in /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard~=2.4->tensorflow) (3.4.0)
Installing collected packages: tensorflow-estimator, tensorboard, flatbuffers, tensorflow
ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

Error: Installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/bin/python3.6

You can install TensorFlow using the install_tensorflow() function.

then it still not working.
3.
Then I tried to use again

model <- keras_model_sequential()

it was saying:

> model <- keras_model_sequential()
Error: Python module tensorflow.keras was not found.

Detected Python configuration:

python:         /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome:     /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate:/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate
version:        3.6.12 |Anaconda, Inc.| (default, Sep  8 2020, 23:10:56)  [GCC 7.3.0]
numpy:          /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version:  1.19.5

P.S
This is all the code that I tried, but all of them are failed.

install.packages("remotes")
remotes::install_github("rstudio/tensorflow")
install.packages("reticulate")
library(tensorflow)
install_tensorflow(version = "2.0.0b1", method = "virtualenv", envname = "r-reticulate")
install.packages("keras")
library(keras)
library

library(tensorflow)
install_tensorflow(package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")

library(tensorflow)
install_tensorflow()

library(reticulate)
library(tensorflow)
library(keras)
virtualenv_create("myenv")
install_tensorflow(method="virtualenv", envname="myenv",
                   package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")


install_keras(method="virtualenv", envname="myenv",
              package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")


model <- keras_model_sequential()


library(reticulate)
library(keras)
virtualenv_create("myenv")
install_keras(method="virtualenv", envname="myenv")

use_condaenv("r-tensorflow")

install.packages('remotes')

library(remotes)
library(devtools)
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")


tensorflow::install_tensorflow()
tensorflow::tf_config()
virtualenv_create("myenv")
install_tensorflow(method="virtualenv", envname="myenv",
                   package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")


install_keras(method="virtualenv", envname="myenv",
              package_url = "https://pypi.python.org/packages/b8/d6/af3d52dd52150ec4a6ceb7788bfeb2f62ecb6aa2d1172211c4db39b349a2/tensorflow-1.3.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=1cf77a2360ae2e38dd3578618eacc03b")

model <- keras_model_sequential()

Thank you!

Have you started from a new project completely? Those errors seem to reference r-miniconda still

I think you need this part at the top, and I was missing a step before:

library(reticulate)
library(keras)
virtualenv_create("myenv")
use_virtualenv("myenv")
install_keras(method="virtualenv", envname="myenv")
use_virtualenv("myenv")

In the portion below, Ming provides a slight tweak of having to use_virtualenv again after the R session reloads. That seems to have solved the problem for that user

Can you please try in a new project, following the instructions above?

Thanks in advance!

-Joshua C. Forest

I started a new session.
But

R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(reticulate)
Error in library(reticulate) : there is no package called ‘reticulate’
> library(keras)
Error in library(keras) : there is no package called ‘keras’
> virtualenv_create("myenv")
Error in virtualenv_create("myenv") : 
  could not find function "virtualenv_create"
> use_virtualenv("myenv")
Error in use_virtualenv("myenv") : 
  could not find function "use_virtualenv"
> install_keras(method="virtualenv", envname="myenv")
Error in install_keras(method = "virtualenv", envname = "myenv") : 
  could not find function "install_keras"
> use_virtualenv("myenv")
Error in use_virtualenv("myenv") : 
  could not find function "use_virtualenv"
> library(reticulate)
> library(keras)
> virtualenv_create("myenv")
Using Python: /usr/bin/python3.5
Creating virtual environment 'myenv' ... Already using interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /cloud/project/myenv/bin/python3.5
Also creating executable in /cloud/project/myenv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Done!
Installing packages: 'pip', 'wheel', 'setuptools', 'numpy'
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Requirement already satisfied: pip in ./myenv/lib/python3.5/site-packages (20.3.3)
Requirement already satisfied: wheel in ./myenv/lib/python3.5/site-packages (0.36.2)
Requirement already satisfied: setuptools in ./myenv/lib/python3.5/site-packages (51.1.2)
Collecting numpy
  Downloading numpy-1.18.5-cp35-cp35m-manylinux1_x86_64.whl (19.9 MB)
Installing collected packages: numpy
Successfully installed numpy-1.18.5
Virtual environment 'myenv' successfully created.
> use_virtualenv("myenv")
> install_keras(method="virtualenv", envname="myenv")
Using virtual environment 'myenv' ...
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting pyyaml==3.12
  Downloading PyYAML-3.12.zip (375 kB)
Collecting tensorflow==2.2.0
  Downloading tensorflow-2.2.0-cp35-cp35m-manylinux2010_x86_64.whl (516.2 MB)
Killed
Error: Error installing package(s): 'tensorflow==2.2.0', 'keras', 'tensorflow-hub', 'h5py', 'pyyaml==3.12', 'requests', 'Pillow', 'scipy'
> use_virtualenv("myenv")

Sorry, you need to install the packages first, R is not my area of expertise, my apologies!

Is this a disk space issue? Can you run df -h from the terminal and paste the output?

Thank you, here it is:

rstudio-user@application-3477433-deployment-8744106-xzwf4:/cloud/project$ df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay         125G   40G   85G  32% /
tmpfs            64M     0   64M   0% /dev
tmpfs            16G     0   16G   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/nbd3       2.7G  105M  2.5G   5% /cloud/project
/dev/nvme0n1p1  125G   40G   85G  32% /opt/R
/dev/nbd0       2.7G   28M  2.6G   2% /home/rstudio-user
tmpfs            16G  4.0K   16G   1% /etc/rstudio/license
/dev/nbd2       2.7G   44M  2.5G   2% /home/rstudio-user/R
/dev/nbd1       2.7G   11M  2.6G   1% /home/rstudio-user/.rstudio
tmpfs            16G     0   16G   0% /proc/scsi
tmpfs            16G     0   16G   0% /sys/firmware
rstudio-user@application-3477433-deployment-8744106-xzwf4:/cloud/project$ 

rstudio-user@application-3477433-deployment-8744106-xzwf4:/cloud/project$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 125G 40G 85G 32% /
tmpfs 64M 0 64M 0% /dev
tmpfs 16G 0 16G 0% /sys/fs/cgroup
shm 64M 0 64M 0% /dev/shm
/dev/nbd3 2.7G 105M 2.5G 5% /cloud/project
/dev/nvme0n1p1 125G 40G 85G 32% /opt/R
/dev/nbd0 2.7G 28M 2.6G 2% /home/rstudio-user
tmpfs 16G 4.0K 16G 1% /etc/rstudio/license
/dev/nbd2 2.7G 44M 2.5G 2% /home/rstudio-user/R
/dev/nbd1 2.7G 11M 2.6G 1% /home/rstudio-user/.rstudio
tmpfs 16G 0 16G 0% /proc/scsi
tmpfs 16G 0 16G 0% /sys/firmware
rstudio-user@application-3477433-deployment-8744106-xzwf4:/cloud/project$

Hello,
Is it possible to solve this problem?
Thank you!