tensorflow-gpu
installation-error
pip-error
wrapt
troubleshooting

ERROR Cannot uninstall 'wrapt'. when installing tensorflow-gpu1.14

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

ERROR: Cannot uninstall 'wrapt' during a tensorflow-gpu==1.14 installation usually means pip is trying to replace an existing wrapt package that it does not fully control. The root problem is rarely TensorFlow alone. It is usually a package-management mismatch between pip, an older system-installed dependency, and an environment that is not isolated enough for a legacy TensorFlow stack.

Why wrapt Causes Trouble

wrapt is a normal Python dependency, but it may already exist in the environment because:

  • the OS package manager installed it
  • another tool bundled it
  • it was installed into a global Python environment with different permissions
  • an older distutils-style install left metadata that pip cannot uninstall cleanly

When tensorflow-gpu==1.14 tries to install or adjust dependencies, pip may decide it needs to replace wrapt. If the existing installation is not safely uninstallable, the process stops with the error.

The Cleanest Fix: Use a Virtual Environment

For legacy packages such as TensorFlow GPU 1.14, the most reliable solution is usually a fresh virtual environment instead of trying to repair a shared Python installation.

bash
1python3 -m venv .venv
2source .venv/bin/activate
3python -m pip install --upgrade pip setuptools wheel
4python -m pip install tensorflow-gpu==1.14

This avoids the system-installed wrapt entirely because the environment starts isolated.

If you are dealing with historical TensorFlow versions, isolation is not optional engineering hygiene. It is usually the easiest path to a reproducible install.

Confirm Which Python and pip You Are Using

Before changing packages, verify the interpreter and installer pair.

bash
python -c "import sys; print(sys.executable)"
python -m pip --version
python -m pip show wrapt

If pip is targeting a different interpreter than the one you plan to use for TensorFlow, the install will keep behaving unpredictably.

Using python -m pip instead of plain pip reduces that ambiguity.

If You Must Stay in the Current Environment

Sometimes you cannot rebuild the environment immediately. In that case, one workaround is to tell pip not to uninstall the existing package and to install the required dependency over it.

bash
python -m pip install --ignore-installed wrapt
python -m pip install tensorflow-gpu==1.14

Another variant is to force a reinstall of wrapt first:

bash
python -m pip install --force-reinstall --no-deps wrapt

Then retry TensorFlow.

This is less clean than using a virtual environment, but it can help when the current environment is already dedicated to a single project and you understand the risks.

System Package Managers and Permissions

If wrapt came from the OS package manager, the correct fix may be to stop mixing system-managed Python packages with project-managed pip packages.

What usually goes wrong is:

  • Ubuntu or another Linux distribution provides Python packages globally
  • 'pip later tries to replace them in place'
  • uninstall metadata or permissions do not line up cleanly

That is exactly the situation virtual environments were designed to avoid.

If you see permission-related failures, do not reach for sudo pip install as the default answer. That often deepens the environment inconsistency instead of solving it.

Remember That TensorFlow GPU 1.14 Is a Legacy Stack

An older TensorFlow GPU release often implies an older compatibility set across:

  • Python version
  • CUDA version
  • cuDNN version
  • package dependency versions

So if installation keeps failing, do not focus only on wrapt. Treat the whole environment as a pinned legacy stack that should be built deliberately.

A good baseline check is:

bash
python -m pip freeze | grep -E 'tensorflow|wrapt|numpy|keras'

This helps you see whether the environment is already a mix of incompatible or partially upgraded pieces.

Common Pitfalls

The most common mistake is trying to install an old TensorFlow GPU package into a shared global Python installation that already contains system-managed dependencies. Another is using plain pip and plain python without confirming they refer to the same interpreter. Developers also often fixate on wrapt when the real issue is that the whole legacy TensorFlow environment should be isolated and recreated cleanly. A final issue is using sudo pip to force the install, which can make the Python installation harder to maintain afterward.

Summary

  • The wrapt uninstall error usually comes from environment management, not from TensorFlow alone.
  • A fresh virtual environment is the cleanest fix.
  • Use python -m pip to make sure installation targets the correct interpreter.
  • If necessary, --ignore-installed or a forced reinstall of wrapt can work around the immediate error.
  • Treat tensorflow-gpu==1.14 as a legacy compatibility stack that should be built in isolation.

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.