Keras: ERROR: dependency 'tensorflow' is not available for package 'keras'

Created on 13 Jun 2017  Â·  11Comments  Â·  Source: rstudio/keras

I am trying to install keras from my Rstudio and R version 3.4.0 Patched , and i get this error--

devtools::install_github("rstudio/keras")

Output

  • installing source package 'reticulate' `...
    ** libs

* arch - i386
c:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-34~1.0PA/include" -DNDEBUG -I"C:/Users/hp/Documents/R/win-library/3.4/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:0:
reticulate_types.h:7:18: fatal error: Rcpp.h: No such file or directory
#include
^
compilation terminated.
make: *
[RcppExports.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-34~1.0PA/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.0PA/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="reticulate.dll" OBJECTS="RcppExports.o interrupt.o libpython.o python.o"' had status 2
ERROR: compilation failed for package 'reticulate'

  • removing 'C:/Users/hp/Documents/R/win-library/3.4/reticulate'
  • restoring previous 'C:/Users/hp/Documents/R/win-library/3.4/reticulate'

installing source package 'tensorflow' ...
* R
*
inst
* tests
*
preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is required
ERROR: lazy loading failed for package 'tensorflow'

  • removing 'C:/Users/hp/Documents/R/win-library/3.4/tensorflow'
    Installation failed: Command failed (1)
    "C:/PROGRA~1/R/R-34~1.0PA/bin/x64/R" --no-site-file --no-environ --no-save
    --no-restore --quiet CMD INSTALL
    "C:/Users/hp/AppData/Local/Temp/Rtmpm6jYvs/devtools277cf242bcc/rstudio-keras-e79e54d"
    --library="C:/Users/hp/Documents/R/win-library/3.4" --install-tests

**ERROR: dependency 'tensorflow' is not available for package 'keras'

  • removing 'C:/Users/hp/Documents/R/win-library/3.4/keras'
    Installation failed: Command failed (1)`**

Most helpful comment

This helped me too. For sake of noobs like me - here are steps I followed in RStudio (using MRAN v3.4.0)
install.packages("Rcpp")
install.packages("devtools")
devtools::install_github("rstudio/reticulate", force=TRUE)
devtools::install_github("r-lib/processx")
library(processx)
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")

All 11 comments

Now i am trying to install it on R version 3.3.3 and i get this error-

devtools::install_github("rstudio/keras")

Output--

Downloading GitHub repo rstudio/keras@master
from URL https://api.github.com/repos/rstudio/keras/zipball/master
Installing keras
Downloading GitHub repo rstudio/reticulate@master
from URL https://api.github.com/repos/rstudio/reticulate/zipball/master
Installing reticulate
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/hp/AppData/Local/Temp/RtmpoFxhSa/devtools28746dd393c/rstudio-reticulate-3e08b34"
--library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests

  • installing source package 'reticulate' ...
    ** libs

* arch - i386
c:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA~1/R/R-33~1.3/include" -DNDEBUG -I"C:/Users/hp/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:0:
reticulate_types.h:7:18: fatal error: Rcpp.h: No such file or directory
#include
^
compilation terminated.
make: *
[RcppExports.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="reticulate.dll" OBJECTS="RcppExports.o interrupt.o libpython.o python.o"' had status 2
ERROR: compilation failed for package 'reticulate'

  • installing source package 'tensorflow' ...
    * R
    *
    inst
    * tests
    *
    preparing package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is required
    ERROR: lazy loading failed for package 'tensorflow'
  • removing 'C:/Users/hp/Documents/R/win-library/3.3/tensorflow'
  • restoring previous 'C:/Users/hp/Documents/R/win-library/3.3/tensorflow'
    Installation failed: Command failed (1)
    "C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save
    --no-restore --quiet CMD INSTALL
    "C:/Users/hp/AppData/Local/Temp/RtmpoFxhSa/devtools287479aa4dd6/rstudio-keras-e79e54d"
    --library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests

  • installing source package 'keras' ...
    * R
    *
    inst
    * tests
    *
    preparing package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is required
    ERROR: lazy loading failed for package 'keras'

  • removing 'C:/Users/hp/Documents/R/win-library/3.3/keras'
    Installation failed: Command failed (1)

It looks like Rpp wasn't / didn't get installed. Maybe try updating
devtools first via install.packages("devtools")
On Tue, Jun 13, 2017 at 5:28 PM Anish Singh Walia notifications@github.com
wrote:

Now i am trying to install it on R version 3.3.3 and i get this error-

devtools::install_github("rstudio/keras")

Output--

Downloading GitHub repo rstudio/keras@master
from URL https://api.github.com/repos/rstudio/keras/zipball/master
Installing keras
Downloading GitHub repo rstudio/reticulate@master
from URL https://api.github.com/repos/rstudio/reticulate/zipball/master
Installing reticulate
"C:/PROGRA1/R/R-331.3/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/hp/AppData/Local/Temp/RtmpoFxhSa/devtools28746dd393c/rstudio-reticulate-3e08b34"

--library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests

  • installing source package 'reticulate' ...
    ** libs

* arch - i386
c:/Rtools/mingw_32/bin/g++ -I"C:/PROGRA1/R/R-331.3/include" -DNDEBUG
-I"C:/Users/hp/Documents/R/win-library/3.3/Rcpp/include"
-I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c
RcppExports.cpp -o RcppExports.o

In file included from RcppExports.cpp:4:0:
reticulate_types.h:7:18: fatal error: Rcpp.h: No such file or directory

include

^
compilation terminated.
make: * [RcppExports.o] Error 1

Warning: running command 'make -f "C:/PROGRA1/R/R-331.3/etc/i386/Makeconf"
-f "C:/PROGRA1/R/R-331.3/share/make/winshlib.mk"
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB="reticulate.dll" OBJECTS="RcppExports.o interrupt.o libpython.o
python.o"' had status 2

ERROR: compilation failed for package 'reticulate'

-

removing 'C:/Users/hp/Documents/R/win-library/3.3/reticulate'
-

restoring previous 'C:/Users/hp/Documents/R/win-library/3.3/reticulate'

-

Installation failed: Command failed (1)

-

Downloading GitHub repo rstudio/tensorflow@master
from URL https://api.github.com/repos/rstudio/tensorflow/zipball/master
Installing tensorflow
Downloading GitHub repo rstudio/reticulate@master
from URL https://api.github.com/repos/rstudio/reticulate/zipball/master
Skipping reticulate, it is already being installed.
"C:/PROGRA1/R/R-331.3/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/hp/AppData/Local/Temp/RtmpoFxhSa/devtools28745cb27c9c/rstudio-tensorflow-2a2d352"

--library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests

-

installing source package 'tensorflow' ...
* R
*
inst
* tests
*
preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck =
vI[[i]]) :
namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is
required
ERROR: lazy loading failed for package 'tensorflow'

-

removing 'C:/Users/hp/Documents/R/win-library/3.3/tensorflow'
-

restoring previous 'C:/Users/hp/Documents/R/win-library/3.3/tensorflow'

-

Installation failed: Command failed (1)

-

"C:/PROGRA1/R/R-331.3/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/hp/AppData/Local/Temp/RtmpoFxhSa/devtools287479aa4dd6/rstudio-keras-e79e54d"

--library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests
-

installing source package 'keras' ...

-

* R
*
inst
* tests
*
preparing package for lazy loading

-

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
versionCheck = vI[[j]]) :

-

namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is
required

-

ERROR: lazy loading failed for package 'keras'
-

removing 'C:/Users/hp/Documents/R/win-library/3.3/keras'

-

Installation failed: Command failed (1)

-

—

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/rstudio/keras/issues/40#issuecomment-308254163, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAGXx10MxRU489RrvuzMEEyE3v25CO9kks5sDv8IgaJpZM4N5Adq
.

I tried reinstalling 'devtools' but still the same error.
Maybe it is the

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'reticulate' 0.8 is being loaded, but >= 0.8.0.9003 is required
RROR: lazy loading failed for package 

which is causing trouble , i looked up for such error but didn't find anything worth.
Any idea about this error?

I also tried installing 'reticulate' separately --
This is the error i get-

>devtools::install_github("rstudio/reticulate")
Downloading GitHub repo rstudio/reticulate@master
from URL https://api.github.com/repos/rstudio/reticulate/zipball/master
Installing reticulate
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  "C:/Users/hp/AppData/Local/Temp/Rtmp2xWToA/devtools1e804f067863/rstudio-reticulate-3e08b34"  \
  --library="C:/Users/hp/Documents/R/win-library/3.3" --install-tests 

* installing *source* package 'reticulate' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-33~1.3/include" -DNDEBUG    -I"C:/Users/hp/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:0:
reticulate_types.h:7:18: fatal error: Rcpp.h: No such file or directory
 #include <Rcpp.h>
                  ^
compilation terminated.
make: *** [RcppExports.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="reticulate.dll" OBJECTS="RcppExports.o interrupt.o libpython.o python.o"' had status 2
ERROR: compilation failed for package 'reticulate'
* removing 'C:/Users/hp/Documents/R/win-library/3.3/reticulate'
Installation failed: Command failed (1)

The fact that Rcpp isn't even available indicates that package installation is not working as expected in your configuration. We don't know of any general failure to install on Windows of this nature. My recommendation would be to build up from scratch as follows:

install.packages("Rcpp")
install.packages("devtools")
devtools::install_github("rstudio/reticulate")
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")

If any of those steps fail then you should try to debug them individually. I'm not sure what else I can do here other than hope that your system supports those commands working correctly!

Thanks a lot for your help and concern , i will try it out from scratch and come back with the results .

Yes it worked , finally.
I debugged it and got to know that package 'jsonlite' and 'curl' were corrupted and i reinstalled them again.Then I uninstalled the 'devtools' and 'Rcpp' packages , again re-installed them , then first installed package 'reticluate' , followed by tensorflow and then i had to install the 'processx ' package then i successfully installed 'keras ' package. And now its running.
Thanks for the help.

Great, so glad you have things working!

This helped me too. For sake of noobs like me - here are steps I followed in RStudio (using MRAN v3.4.0)
install.packages("Rcpp")
install.packages("devtools")
devtools::install_github("rstudio/reticulate", force=TRUE)
devtools::install_github("r-lib/processx")
library(processx)
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")

Outstanding. Thank you. Big help.

Had same error and turned out during the TensorFlow local GPU installation process the computer's default R version switched to Microsoft R Open which apparently can't install TensorFlow. Giveaway should have been all R User Library packages were missing, but after that process on Windows, nothing is surprising :)
Resolved with switching back to R-3.5.0:
Tools->Global Options->General->R-version->Change->Choose a specific version of R->R-3.5.0 etc. ->OK

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MaximilianPi picture MaximilianPi  Â·  5Comments

gokceneraslan picture gokceneraslan  Â·  6Comments

aliarsalankazmi picture aliarsalankazmi  Â·  4Comments

leonjessen picture leonjessen  Â·  4Comments

gundalav picture gundalav  Â·  3Comments