Lera Cherepanova
Lera Cherepanova

Reputation: 21

Error when I try to install keras on R (devtools::install_github("rstudio/keras")

I am fairly new to R, so I apologize if my question is trivial. I try to install keras on R (version 3.4.1). I installed package devtools, but when I download keras with

devtools::install_github("rstudio/keras") 

I get the next error:

Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Downloading GitHub repo rstudio/keras@master
from URL https://api.github.com/repos/rstudio/keras/zipball/master
Installing keras
Warning message in utils::untar(src, exdir = target, compressed = 
"gzip"): 
“‘/bin/gtar -xf '/tmp/RtmppsizUk/R6_2.2.2.tar.gz' -C 
'/tmp/RtmppsizUk/devtools58a921ad859f'’ 
returned error code 127”Installation failed: error in running
command
Downloading GitHub repo rstudio/tensorflow@master
from URL https://api.github.com/repos/rstudio/tensorflow/zipball
/master
Installing tensorflow
Warning message in utils::untar(src, exdir = target, compressed = 

"gzip"):
“‘/bin/gtar -xf '/tmp/RtmppsizUk/processx_3.1.0.tar.gz' -C 
'/tmp/RtmppsizUk/devtools58a939032642'’ returned error code 
127”Installation failed: error in running command

Warning message in utils::untar(src, exdir = target, compressed = 
"gzip"):

“‘/bin/gtar -xf '/tmp/RtmppsizUk/yaml_2.1.19.tar.gz' -C 
'/tmp/RtmppsizUk/devtools58a949f478b4'’ returned error code 
127”Installation failed: error in running command

'/home/valeriya/anaconda3/envs/myenv/lib/R/bin/R' --no-site-file 
--no-environ  \

--no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmppsizUk/devtools58a913225b77/rstudio-tensorflow-d6df08f'\
  --library='/home/valeriya/anaconda3/envs/myenv/lib/R/library'  \
  --install-tests 

Installation failed: Command failed (1)
'/home/valeriya/anaconda3/envs/myenv/lib/R/bin/R' --no-site-file 
--no-environ  \

 --no-save --no-restore --quiet CMD INSTALL  \

'/tmp/RtmppsizUk/devtools58a95a711ad4/rstudio-keras-900088e'  \

--library='/home/valeriya/anaconda3/envs/myenv/lib/R/library'  \

 --install-tests 


Installation failed: Command failed (1)

When I try to install it via

install.packages("keras")

I get the next warning message:

also installing the dependencies ‘cli’, ‘testthat’, ‘processx’,     
‘tensorflow’

Warning message in install.packages("keras"):
“installation of package ‘cli’ had non-zero exit status”Warning 
message in install.packages("keras"):
“installation of package ‘testthat’ had non-zero exit status”Warning 
message in install.packages("keras"):
“installation of package ‘processx’ had non-zero exit status”Warning 
message in install.packages("keras"):
“installation of package ‘tensorflow’ had non-zero exit 
status”Warning message in install.packages("keras"):
“installation of package ‘keras’ had non-zero exit status”Updating 
HTML index of packages in '.Library'
Making 'packages.html' ... done

After that loading keras via

library('keras')

gives

Error in library("keras"): there is no package called ‘keras’
Traceback:

1. library("keras")
2. stop(txt, domain = NA)

How can I fix it? Thank you in advance!

Upvotes: 2

Views: 1853

Answers (1)

dynamicwebpaige
dynamicwebpaige

Reputation: 393

RStudio has an excellent TensorFlow with R walkthrough on its website! Check out the full documentation for installation and usage here.

To install Keras for R:

devtools::install_github("rstudio/keras")

Then, after you've used devtools to clone rstudio/keras from GitHub:

library(keras) install_keras()

Upvotes: 1

Related Questions