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.
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 thatpipcannot 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.
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.
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.
Another variant is to force a reinstall of wrapt first:
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
- '
piplater 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:
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
wraptuninstall error usually comes from environment management, not from TensorFlow alone. - A fresh virtual environment is the cleanest fix.
- Use
python -m pipto make sure installation targets the correct interpreter. - If necessary,
--ignore-installedor a forced reinstall ofwraptcan work around the immediate error. - Treat
tensorflow-gpu==1.14as a legacy compatibility stack that should be built in isolation.
Related reading
- Error OOM when allocating tensor with shape
- Error Out Of Memory, tensorflow cnn
- Error Propagation in Keras DNN and/or CNN Regression
- Error running basic tensorflow example
- ERROR Could not find a version that satisfies the requirement tensorflow from versions none ERROR No matching distribution found for tensorflow
- Error Failed to load the native TensorFlow runtime
- ERROR Could not build wheels for scipy which use PEP 517 and cannot be installed directly
- ERROR Could not install packages due to an OSError WinError 5
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.