Ubuntu – Install TensorFlow with Python3 on Ubuntu 16.04

16.04python3

When I try to install tensorflow package with pip3 on Ubuntu 16.04 I obtained this error message:

The directory '/home/federico/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/federico/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

tensorflow-0.7.1-cp34-none-linux_x86_64.whl is not a supported wheel on this platform.

How I can fix the problem?

Best Answer

The issue is that Ubuntu 16 uses Python3.5 but Tensorflow only provides a wheel for Python 3.4 (indicated by 'cp34' in "tensorflow-0.7.1-cp34-none-linux_x86_64.whl"). Luckily the Wheel is actually compatible with Python 3.5, so you don't need to compile from source.

You need to download the wheel, rename it to prevent the python 3.4 check from failing, and then install by passing the renamed file to pip.

For the current version of Tensorflow (peeps in the future, check the website for the latest version and adapt commands below if necessary) run:

wget https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
mv tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl tensorflow-0.8.0-cp35-none-linux_x86_64.whl
pip install tensorflow-0.8.0-cp35-none-linux_x86_64.whl
Related Question