Jixiong LIU (Yansera-衍之)
Articles6
Tags7
Categories4
Installing tensorflow 1.15 in Linux using pip

Installing tensorflow 1.15 in Linux using pip

Trying to install ampligraph today, using pip in the process of using

pip install "tensorflow-gpu>=1.15.2,<2.0"

Harvesting bugs perfectly

ERROR: Could not find a version that satisfies the requirement tensorflow-gpu<2.0,>=1.15.2 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.8.0rc0, 2.8.0rc1, 2.8.0)

ERROR: No matching distribution found for tensorflow-gpu<2.0,>=1.15.2

The main reason is that my current python version is 3.9, and tensorflow 1.15 is only compatible with versions before 3.7, so I can’t find the relevant version in the library
Using conda to create a python 3.7 environment can be a direct solution, but because of the environment limitation, it is not possible to use conda and can only be installed via pip.
The version qualification of python allows you to specify the python version directly for pip matching, so you only need to change to

python3.7 -m pip install "tensorflow-gpu>=1.15.2,<2.0"

It will fix it.


However, apt install python3.7 is not recognized by the old man
so you need to specify the library:

apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
python3.7 -m pip install "tensorflow-gpu>=1.15.2,<2.0"

OK Solved

After that, just remember to run the code with python 3.7

root@1dd80e7ada30:/# python3.7 -c 'import tensorflow as tf; print(tf.__version__)'
1.15.5
Author:Jixiong LIU (Yansera-衍之)
Link:https://www.yansera.com/2021/07/27/Installing%20tensorflow%201.15%20in%20Linux%20using%20pip/
Copyright Notice:This artical uses CC BY-NC-SA 3.0 licensing agreements