I tried running the following code in RStudio:
library(tensorflow)
x_data <- runif(100, min=0, max=1)
y_data <- x_data * 0.1 + 0.3
W <- tf$Variable(tf$random_uniform(shape(1L), -1.0, 1.0))
But the last line is throwing the following error:
Error: Python module tensorflow was not found.
Detected Python configuration:
python: /usr/bin/python
libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version: 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]
numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
numpy_version: 1.8.1
tensorflow: [NOT FOUND]
This is my first time attempting to incorporate Python in RStudio (for purposes of accessing Tensorflow), so I'm not sure what I should check (or where) to make sure that my settings are appropriate.
I realize that I installed the python 3 version of tensorflow instead of the python 2 version, which is what my error message was telling me that RStudio is using. Using the install instructions found here, I installed tensorflow on python 2 and was able to run the above code.
The current CRAN version of the tensorflow package requires you to install the Python tensorflow module first.
The github version has a function, "install_tensorflow()", that tries to do it for you. Try that version.
Note that the python module has pretty strict requirements so this may still fail. Consult the python tensorflow docs in this event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With