1 Goal


The goal of this tutorial is to install tensorflow properly in our system to use it in R


2 Tensorflow installation


# First we load the libraries
library(tensorflow)
library(reticulate)
# We want to install the CPU version of tensorflow
install_tensorflow(version = "nightly")

3 Check installation


# We can find where tensorflow has been installed
# If the installation has not been successful we will get a [NOT FOUND] message on tensorflow location
py_discover_config("tensorflow")
## python:         /anaconda3/envs/r-tensorflow/bin/python
## libpython:      /anaconda3/envs/r-tensorflow/lib/libpython3.6m.dylib
## pythonhome:     /anaconda3/envs/r-tensorflow:/anaconda3/envs/r-tensorflow
## version:        3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
## numpy:          /anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/numpy
## numpy_version:  1.16.1
## tensorflow:     /anaconda3/envs/r-tensorflow/lib/python3.6/site-packages/tensorflow
## 
## python versions found: 
##  /anaconda3/envs/r-tensorflow/bin/python
##  /usr/bin/python

4 Conclusion


In this tutorial we have learnt how to install the proper version of tensorflow to use in R.