How To Install Tensorflow 1.X On Windows, Macos, And Linux In 2026

You Need TensorFlow 1.x, But Modern Python Hates It

You’re staring at a legacy codebase, a research paper’s repository, or an old machine learning model. The README file clearly states: “Requires TensorFlow 1.x.” You try a simple pip install tensorflow, and you’re greeted with TensorFlow 2.15 or later. Suddenly, nothing runs. Import errors about tf.contrib, sessions, and placeholders flood your terminal. The modern ecosystem has moved on, but your project hasn’t.

This is a common and frustrating hurdle for developers, researchers, and students working with older AI projects. TensorFlow 2.x introduced fundamental, breaking changes eager execution by default, the removal of the tf.contrib module, and a complete API overhaul. While migration guides exist, sometimes you just need the original environment to run, evaluate, or extract a model.

Installing TensorFlow 1.x in 2026 is not a simple one-line command. It requires navigating Python version constraints, finding the correct archived package, and often using virtual environments to avoid corrupting your main Python setup. This guide provides the definitive, step-by-step methods to get TensorFlow 1.15.0 the final and most stable 1.x release running on any major operating system.

Prerequisites and the Crucial First Step

Before typing any install command, you must set up a virtual environment. This is non-negotiable. It isolates your TensorFlow 1.x installation, preventing conflicts with other packages and your system Python. We’ll use venv, which is built into Python 3.

First, ensure you have a compatible Python version. TensorFlow 1.15.0 supports Python 3.5 through 3.7. Python 3.7 is the highest you can go. You likely have a newer version installed. Check by running python –version or python3 –version in your terminal.

If you need Python 3.7, you can install it alongside your current version. On macOS with Homebrew, use brew install python@3.7. On Ubuntu/Debian, use apt install python3.7 and python3.7-venv. On Windows, download the installer from the official Python archives.

Creating and Activating Your Isolated Environment

Open your terminal or command prompt. Navigate to your project directory. Now, create the virtual environment. The command differs slightly by OS because of the Python version.

For Linux/macOS with Python 3.7 installed as python3.7:

python3.7 -m venv tf1_env

For Windows with Python 3.7 installed and in your PATH:

python -m venv tf1_env

If your system’s default python command points to 3.7, you can use python -m venv tf1_env on any OS. The last part, tf1_env, is the name of the environment folder you can choose any name.

Next, activate the environment. This changes your shell’s context to use the Python and pip inside that folder.

On Linux and macOS:

source tf1_env/bin/activate

On Windows (Command Prompt):

tf1_env\Scripts\activate.bat

On Windows (PowerShell):

how to install tensorflow 1 x

tf1_env\Scripts\Activate.ps1

Your command prompt should now show (tf1_env) at the beginning, confirming you are inside the environment. All subsequent commands assume you are in this activated state.

The Core Installation Methods for TensorFlow 1.15

With your environment active, you can proceed to install TensorFlow. There are two primary reliable sources: PyPI using a specific version pin, and direct installation via the archived wheel files from Google.

Method 1: Direct Install from PyPI (Simplest)

This method uses pip to install the specific version from the Python Package Index. It often works, but may fail on very new hardware or OS versions due to missing legacy dependencies. Run the following command:

pip install tensorflow==1.15.0

Pip will fetch the appropriate wheel file for your platform. This installs the CPU-only version. If you need GPU support for NVIDIA cards, the command is slightly different:

pip install tensorflow-gpu==1.15.0

Important note for GPU support: TensorFlow 1.15 requires specific, older versions of CUDA and cuDNN. You will need CUDA 10.0 and cuDNN 7.6.5. Installing these is a complex process beyond this guide. For most users needing to run legacy code, the CPU version is sufficient and far easier.

Let the installation complete. It may take a minute as it downloads dependencies like numpy, six, and others.

Method 2: Installing from a Downloaded Wheel File (More Reliable)

If the PyPI method fails often due to SSL errors or compatibility issues, you can download the wheel file directly and install it locally. This is the most robust approach.

First, visit the official TensorFlow release page on GitHub. Navigate to the release section for version 1.15.0. Alternatively, use this direct link to the list of wheel files. Look for the file matching your system.

For example, for macOS with Python 3.7:

tensorflow-1.15.0-cp37-cp37m-macosx_10_11_x86_64.whl

For Linux with Python 3.7 and CPU support:

tensorflow-1.15.0-cp37-cp37m-manylinux2010_x86_64.whl

For Windows with Python 3.7 and CPU support:

tensorflow-1.15.0-cp37-cp37m-win_amd64.whl

how to install tensorflow 1 x

Download the correct .whl file to your project folder. Then, install it using pip:

pip install /path/to/downloaded/tensorflow-1.15.0-*.whl

Replace the asterisk with the full filename. This method bypasses PyPI’s resolution and installs the exact binary.

Verifying Your Installation and Running a Test

Never assume the install worked. Always verify. Start a Python interpreter from within your activated environment by typing python in the terminal.

Then, run these verification commands line by line:

import tensorflow as tf

print(tf.__version__)

hello = tf.constant(‘Hello, TensorFlow 1.x!’)

sess = tf.Session()

print(sess.run(hello))

You should see output confirming version 1.15.0 and the successful execution of the session, printing the hello string. This confirms the core library is installed and the classic Session API works.

If you see an error about “DLL load failed” on Windows, it’s often a Visual C++ Redistributable issue. Install the Microsoft Visual C++ 2015-2019 Redistributable. If you see an error about “Could not find a version that satisfies the requirement,” double-check your Python version and that you are in the correct virtual environment.

Troubleshooting Common Installation Blockers

Even with careful steps, you might hit roadblocks. Here are solutions to the most frequent issues.

Error: “No matching distribution found for tensorflow==1.15.0”

This almost always means your Python version is too high. TensorFlow 1.15 is not built for Python 3.8+. Deactivate your environment, check your Python version with python –version, and recreate the environment using Python 3.7 as shown in the prerequisites.

On some Linux distributions, you may need to ensure pip is upgraded within the environment. Run pip install –upgrade pip before trying the install again.

Error: “Failed building wheel for h5py” or other compilation errors

This occurs when pip tries to build a dependency from source because no pre-built wheel is available for your platform. The simplest fix is to install a slightly older, more compatible version of the problematic library first. Try this sequence:

pip install numpy==1.19.5

how to install tensorflow 1 x

pip install h5py==2.10.0

pip install tensorflow==1.15.0

This provides binary wheels that TensorFlow 1.15 expects.

ImportError: “cannot import name ‘get_config’ from ‘tensorflow.python.eager.context'”

This is a classic sign of mixing TensorFlow 1.x and 2.x code or having a corrupted install. It can also happen if you installed tensorflow (version 2) and tensorflow-gpu (version 1) in the same environment. The fix is to nuke the environment and start clean.

Deactivate the environment.

Delete the environment folder (e.g., rm -rf tf1_env).

Recreate it with Python 3.7, activate it, and install only tensorflow==1.15.0 or tensorflow-gpu==1.15.0, not both.

Working with Your Legacy TensorFlow 1.x Code

Now that you have a working environment, you can run your old scripts. Remember the key differences you’ll encounter compared to TensorFlow 2.

You must explicitly create and manage tf.Session() objects to run computations. Graphs are built implicitly, and you call sess.run() to evaluate tensors. Placeholders (tf.placeholder) are used for feeding external data. The tf.contrib module contains many experimental utilities, but be aware some submodules may not be fully functional.

To make your life easier, consider adding these lines at the top of your old scripts to ensure compatibility and suppress deprecation warnings:

import tensorflow as tf

tf.compat.v1.disable_eager_execution() # Forces 1.x-style graph execution

tf.compat.v1.disable_v2_behavior() # Disables TensorFlow 2.x APIs

This uses the compatibility module to create a more predictable 1.x-like environment, even if there are some v2 libraries present.

Your Strategic Path Forward

You now have a functional TensorFlow 1.15 installation. This environment is a tool for a specific purpose: running, debugging, or converting legacy models. It is not for new development. Keep this environment isolated and document its purpose.

For the long term, evaluate if you can migrate the model or code to TensorFlow 2. The tf.keras API in TF2 is largely stable and offers significant performance and usability benefits. Use the tf_upgrade_v2 script that comes with TensorFlow 2.x installations to attempt an automatic conversion of your old code. It’s not perfect, but it handles many common patterns.

If the model is only for inference, consider exporting it to a standard format like ONNX or TensorFlow SavedModel using tools from within your TF1 environment, then loading it into a modern runtime. This breaks the dependency on the old library entirely.

Finally, remember to deactivate your virtual environment when you’re done by simply typing deactivate in the terminal. When you need to work on the project again, navigate back and run the activation command. This keeps your system clean and your legacy project reliably alive, ready to run whenever you need it.

Leave a Comment

close