Error while installing Tensorflow in R

I am trying to install Tensorflow in R as explained here- https://github.com/rstudio/tensorflow. I want to use Keras for deep learning in R.

devtools::install_github("rstudio/tensorflow") 

library(tensor flow)

install_tensorflow()

The first two lines worked but the last line gave the following error:-

Error: Prerequisites for installing TensorFlow not available.
Any idea how to resolve this? I have installed anaconda and python 3.6. And I am using Mac OS X.

You might try overriding the auto installation method with conda if you are using anaconda: