Im trying to run a simple python script that uses Tensorflow to print the available GPU devices. The script is
from tensorflow.python.client import device_lib
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
get_available_gpus()
I have the following related modules installed:
pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python3.5/dist-packages
Requires: wheel, six, tensorflow-tensorboard, numpy, absl-py, protobuf
However, when I run the script I get the following error:
python get_available_gpus.py
Traceback (most recent call last):
File "get_available_gpus.py", line 2, in <module>
from tensorflow.python.client import device_lib
ImportError: No module named tensorflow.python.client