Unable to install Tensorflow GPU acceleration in R

I don't usually use Python, but I installed the Intel Python distro for scientists a several months back because I thought I would get into it while I was using Python to design a Snakemake workflow. For some reason, this seriously interfered with my ability to use the Snakemake module in Python so I had to uninstall it and reinstall it and I did all sorts of stuff that I now no longer remember and am convinced somehow corrupted my PC's ability to have a functioning copy of Python on a low-level.

Fast-forward to now, I'm trying to use R's versions of Keras and Tensorflow but I am running into problems.

I was able to successfully install both Keras and Tensorflow as per the user instructions found here and here, but when I try to install GPU acceleration, I get the following error:

> library(keras)
> library(tensorflow)
> install_tensorflow(version = "gpu")
Error: could not find a Python environment for C:\Users\artas\AppData\Local\Programs\Python\Python39\python.exe

I posted about this on Stack Overflow where I was told to install either Conda or Miniconda (by the way, I have next to no experience with Python) and use reticulate to create a conda environment for R, and install Tensorflow's GPU acceleration. py_config() returns an unsuccessful configuration:

> reticulate::py_config()
python:         C:/Users/artas/AppData/Local/Programs/Python/Python39/python.exe
libpython:      C:/Users/artas/AppData/Local/Programs/Python/Python39/python39.dll
pythonhome:     C:/Users/artas/AppData/Local/Programs/Python/Python39
version:        3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
Architecture:   64bit
numpy:           [NOT FOUND]
tensorflow:     [NOT FOUND]

NOTE: Python version was forced by use_python function

As you can see, tensorflow is not found. I also tried to use conda_install to install tensorflow and strangely it's apparently successful.

> reticulate::conda_install(envname = "r-reticulate", packages = "tensorflow")
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

# All requested packages already installed.

Earlier I was getting the following error but I'm inexplicably no longer getting it anymore:

> tensorflow::install_tensorflow(version = "gpu")
Error: .onLoad failed in loadNamespace() for 'tensorflow', details:
  call: py_module_import(module, convert = convert)
  error: ModuleNotFoundError: No module named 'tensorflow'

Detailed traceback: 
  File "C:\Users\artas\Documents\R\win-library\4.0\reticulate\python\rpytools\loader.py", line 19, in _import_hook
    module = _import(
  File "C:\Users\artas\Documents\R\win-library\4.0\reticulate\python\rpytools\loader.py", line 19, in _import_hook
    module = _import(

Like I said before, I feel like I somehow screwed up my PC's ability to have a functional copy of Python and should just dual boot Ubuntu or something. Does anyone have any advice or can make heads or tails of this?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.