Unavailable to install Tensorflow 1.x on Ubuntu 20.04 LTS using pip

Viewed 6589

I have a reason that I should use Tensorflow 1.x release, but it returns an error with message:

ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.2 (from versions: 2.2.0.rc1 ~~~~~
ERROR: No matching disribution found for tensorflow==1.15.2

enter image description here

I also tried .whl installation but the latest Tensorflow 1.15.2 support cp37 which I can't use it anymore.

Is tensorflow 1.x is no longer supported on pip or pypi? Or should I downgrade python(3.8 > 3.7) and install Tensorflow using .whl file?

[System Environment] Ubuntu 20.04 LTS Python version : 3.8.2 pip version : 20.0.2

Thanks.

4 Answers

According to tensorflow installation guide tensorflow is available on Python 3.5–3.7 you are using a newer version of Python.


The answer above is outdated

Tensorflow supports Python 3.8 now, but Python 3.8 support requires

  • TensorFlow 2.2 or later
  • pip 19.0 or later
  • Ubuntu 16.04 or later
  • macOS 10.12.6 (Sierra) or later
  • Windows 7 or later
  • Raspbian 9.0 or later

Also GPU support requires a CUDA-enabled card (Ubuntu and Windows)

You can check your Python and pip version with these commands:

python --version | python3 --version
Out: Python 3.8.2

pip --version | pip3 --version
Out: pip 20.1.1

You can upgrade your pip with:

pip install --upgrade pip

More info can be found on this link: Install TensorFlow with pip

I would recommend that you avoid installing third-party Python libraries system-wide using pip that will then rely on your system Python. You also really don't want to avoid manually upgrading/downgrading your system Python.

I prefer to use Conda to install TensorFlow. Instructions for installing Conda on Linux are pretty straightforward.

Once you have installed Conda you can install TensorFlow 1.15 with a single command.

conda create --name tensorflow-15 \
    tensorflow-gpu=1.15 \
    cudatoolkit=10.1 \
    cudnn=7.6 \
    nccl=2.4 \ # only relevant if you have more than one GPU
    python=3.6 \
    pip=20.0 

One of the many things I like about Conda is that it provides a single tool to manage environments and packages within a particular environment. It also has a much gentler learning curve compared with other tools for isolating software environments like Docker.

If you are interested in learning more about Conda, then you can check out these teaching materials that I am developing.

https://carpentries-incubator.github.io/introduction-to-conda-for-data-scientists/

Seems more and more we have to switch to using containers (Docker, and probably cloud VMs), because everything is incompatible with everything. Yes, you can start a Docker container running Python 3.7 and Tensorflow 1.x, on any version of Linux, but then you want to load files from that container, you have to pass black-magic command line options to mount volumes. Tried using Tensorflow 2 and everything fails. No more tf.Session(), no more tf.global_variables_initializer(), etc. So no working Tensorflow in Ubuntu, you have to use Docker.

Try to isolate your dependencies by using Docker or conda environments, I used:

conda create -n new_env  python=3.6 tensorflow-gpu=1.2.1 anaconda

and works fine:)

Related