Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Tensorflow 2.x only for CPU using PIP

how do you install only a CPU version of Tensorflow 2.x using pip ? In the past, it was possible to install this 2 different versions.

Since I am running the scripts in a nonen GPU device ( without envidia card, intel card available without cuda support), I am getting following error:

2020-04-14 23:28:14.632879: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory 2020-04-14 23:28:14.632902: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)

In the past my workaround was to use a CPU only version.

Thanks for the hints in advance

like image 214
Mono Brezel Avatar asked Apr 13 '20 16:04

Mono Brezel


People also ask

Can I install TensorFlow GPU without GPU?

If a TensorFlow operation has no corresponding GPU implementation, then the operation falls back to the CPU device. For example, since tf. cast only has a CPU kernel, on a system with devices CPU:0 and GPU:0 , the CPU:0 device is selected to run tf. cast , even if requested to run on the GPU:0 device.

Can you install TensorFlow with pip?

TensorFlow requires a recent version of pip, so upgrade your pip installation to be sure you're running the latest version. Then, install TensorFlow with pip. Note: Do not install TensorFlow with conda. It may not have the latest stable version.


2 Answers

You can choose the CPU-only version of tensorflow depending on your python version. Check the list here: https://www.tensorflow.org/install/pip#package-location

e.g. you will need to do the following for Python 3.8:

pip3 install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.3.0-cp38-cp38-manylinux2010_x86_64.whl
like image 176
DesiKeki Avatar answered Nov 12 '22 06:11

DesiKeki


Issue solved after installing a CPU only version.

I used pin tensorflow-cpu and the version of the release. Somehow the fallback solution for CPU did not work in my setup.

like image 36
Mono Brezel Avatar answered Nov 12 '22 05:11

Mono Brezel