TensorFlow
Python 3.8
Installation Guide
Machine Learning
Python Libraries

How to install TensorFlow with Python 3.8

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

Introduction

As of March 7, 2026, the current tensorflow package on PyPI requires Python >=3.10, so you cannot just run pip install tensorflow inside a Python 3.8 environment and expect the latest release to work. If you must stay on Python 3.8, the practical solution is to create a Python 3.8 virtual environment and install a TensorFlow release that still supports it, such as tensorflow==2.13.1.

Why The Plain Install Fails

If you try this in Python 3.8:

bash
python3.8 -m pip install tensorflow

pip may fail with a version-compatibility message or report that no matching distribution is available for the latest release. That is because current TensorFlow wheels target newer Python versions.

So the real question is not "how do I install the latest TensorFlow with Python 3.8" but rather "which compatible TensorFlow release should I install in a Python 3.8 environment."

Create A Python 3.8 Virtual Environment

Always start with an isolated environment.

bash
python3.8 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

On Windows Command Prompt:

bat
python3.8 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip

This keeps your TensorFlow dependencies separate from the rest of the machine.

Install A Python 3.8-Compatible TensorFlow Release

For Python 3.8, install a version that still publishes compatible wheels. A practical example is:

bash
python -m pip install tensorflow==2.13.1

Then verify it:

bash
python -c "import tensorflow as tf; print(tf.__version__)"

If the import works and prints the expected version, the installation is in place.

Minimal Sanity Check

Do not stop at version output. Run a tiny TensorFlow computation too.

bash
1python - <<'PY'
2import tensorflow as tf
3
4x = tf.constant([[1.0, 2.0], [3.0, 4.0]])
5y = tf.constant([[5.0, 6.0], [7.0, 8.0]])
6print(tf.matmul(x, y))
7PY

That confirms the package imports and executes basic tensor operations.

If python3.8 Is Not Found

On some systems, Python 3.8 is not available by default under that exact executable name. Check what is installed:

bash
python3.8 --version
python3 --version
python --version

If Python 3.8 is not installed yet, install it first through your OS package manager, pyenv, or the official Python distribution for your platform.

CPU Versus GPU Expectations

Most installation problems are actually version and environment problems, not GPU problems. Get the CPU installation working first. Only then worry about GPU acceleration.

Also remember that older TensorFlow versions may have different GPU support expectations than current releases. When you are locked to Python 3.8, you are also usually accepting an older TensorFlow compatibility matrix.

When Upgrading Python Is The Better Answer

If you are free to upgrade, that is usually the better long-term path.

Reasons:

  • current TensorFlow releases target newer Python versions
  • newer Python versions get longer support windows
  • dependency resolution becomes easier
  • you avoid being stuck on an older TensorFlow line

So install TensorFlow on Python 3.8 only when an existing environment or dependency constraint actually requires it.

Common Pitfalls

  • Running pip install tensorflow in Python 3.8 and assuming the latest release should work.
  • Installing into the wrong interpreter because the shell's python is not the same as python3.8.
  • Skipping virtual environments and mixing packages across multiple Python setups.
  • Treating GPU setup as the first problem when basic version compatibility is the real blocker.
  • Forgetting to verify the install with both print(tf.__version__) and a small tensor operation.

Summary

  • Current TensorFlow releases no longer target Python 3.8.
  • If you must use Python 3.8, install a compatible older release such as tensorflow==2.13.1 in a virtual environment.
  • Start with a clean python3.8 -m venv environment and upgrade pip first.
  • Verify the installation by importing TensorFlow and running a small computation.
  • If you are not forced to stay on Python 3.8, upgrading Python is usually the better solution.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

All Rights Reserved.