How to Install TensorFlow with uv
TensorFlow is Google's open-source library for machine learning, and Keras, the library you build models with, comes with it. This guide installs both into a uv project with one command, then checks that they work, with TensorFlow 2.22.0 and Keras 3.15.1 on Python 3.14.
Syntax
uv add tensorflow
| Part | What it means |
|---|---|
uv add | Adds a package to the project in the current folder, and records it in pyproject.toml and uv.lock |
tensorflow | TensorFlow's package on PyPI. It brings Keras, NumPy and the rest of what TensorFlow needs |
The TensorFlow 2.22.0 release notes say it "Added official support for Python 3.14 (cp314) across Linux, macOS, and Windows (supporting Python 3.10–3.14)".
The Example
A new project, tensorflow-demo, gets TensorFlow, then reports the version it got and runs a small calculation.
Prerequisites
- uv. This guide uses uv 0.13.10. It downloads Python 3.14 for you if your computer doesn't have it.
- About 1.5 GB of free disk space. The project's packages took 1.4 GB here.
Step 1: Create the Project on Python 3.14
uv init --python 3.14 tensorflow-demo
cd tensorflow-demo
Initialized project `tensorflow-demo` at `/Users/you/source/tensorflow-demo`

Why 3.14 and not the newer 3.15? TensorFlow 2.22.0 publishes packages for Python 3.10 to 3.14 only, so on 3.15 uv add tensorflow fails. Fixed: "all versions of tensorflow have no wheels with a matching Python version tag (e.g., cp315)" shows that error and the fix.
Step 2: Add TensorFlow
uv add tensorflow
Using CPython 3.14.10
Creating virtual environment at: .venv
Resolved 32 packages in 1.84s
Built tensorflow-demo @ file:///Users/you/source/tensorflow-demo
Prepared 32 packages in 26.98s
Installed 32 packages in 239ms
+ absl-py==2.5.1
+ astunparse==1.6.3
+ certifi==2026.11.20
+ charset-normalizer==3.5.3
+ flatbuffers==25.12.19
+ gast==0.7.0
+ google-pasta==0.2.0
+ grpcio==1.86.0
+ h5py==3.15.1
+ idna==3.20
+ keras==3.15.1
+ libclang==18.1.1
+ markdown-it-py==4.3.0
+ mdurl==0.1.2
+ ml-dtypes==0.7.0
+ namex==0.1.0
+ numpy==2.5.5
+ opt-einsum==3.4.0
+ optree==0.20.0
+ packaging==26.4
+ protobuf==7.36.2
+ pygments==2.21.0
+ requests==2.34.2
+ rich==15.0.0
+ six==1.17.0
+ tensorflow==2.22.0
+ tensorflow-demo==0.1.0 (from file:///Users/you/source/tensorflow-demo)
+ termcolor==3.3.0
+ typing-extensions==4.16.0
+ urllib3==2.8.0
+ wheel==0.48.0
+ wrapt==2.5.2

uv created the project's virtual environment, .venv, and installed 32 packages: TensorFlow, the 30 packages it needs, and the project itself. A few of them matter later:
| Package | What it does |
|---|---|
keras | The library you build and train models with. TensorFlow 2.22.0 comes with Keras 3 |
numpy | Arrays of numbers. TensorFlow turns them into tensors and back |
h5py | Reads and writes HDF5 files, an older format for saved models |
protobuf | The format TensorFlow uses for saved models and graphs |
TensorBoard, TensorFlow's training dashboard, isn't in the list. The release notes for 2.22.0 explain: "The TensorBoard dependency is no longer included by default." Add it with uv add tensorboard when you need it.
Step 3: Check the Version
uv run python -c "import tensorflow as tf; print(tf.__version__)"
2.22.0

This command took 39 seconds on an M1 Pro: the first time TensorFlow loads in a new environment, it's slow. The same command, run again, took 4 seconds.
Step 4: Run TensorFlow's Own Check
The TensorFlow installation guide verifies an installation with this line. It adds up a million random numbers:
uv run python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
tf.Tensor(-318.15567, shape=(), dtype=float32)

tf.random.normal([1000, 1000]) made a 1,000 by 1,000 table of random numbers, and tf.reduce_sum added them up. Your number will be different, because the numbers are random. What matters is that a tf.Tensor came back: TensorFlow works. The commands on this page work unchanged in PowerShell.
A GPU on Linux or Windows
On this Mac, TensorFlow runs on the CPU: the installation guide says "There is currently no official GPU support for MacOS." On Linux with an NVIDIA GPU, the guide installs tensorflow[and-cuda], which in a uv project is uv add "tensorflow[and-cuda]". On Windows, it warns that "TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows", and points to WSL2. I haven't run either here: this Mac has no NVIDIA GPU.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Creating the project on Python 3.15 | uv add tensorflow fails: TensorFlow 2.22.0 has no packages for 3.15 | Use --python 3.14 |
Running python -c "import tensorflow" outside the project | ModuleNotFoundError: No module named 'tensorflow', unless your system Python has its own copy: the package is in the project's .venv | Run it through uv run from the project folder |
| Thinking the first import has hung | It's slow once per new environment: 39 seconds here | Wait for it; the next import is quick |
FAQ
Do I need to install Keras separately?
No. uv add tensorflow installed Keras 3.15.1 with it, and import keras works straight away.
Can I use pip instead of uv?
Yes. The installation guide uses pip install tensorflow. uv adds a project, a lock file and a pinned Python version, which keeps installs repeatable.
Conclusion
uv add tensorflow installed TensorFlow 2.22.0 and Keras 3.15.1 into a Python 3.14 project. The version check printed 2.22.0, and TensorFlow's own check returned a tensor.
Additional Resources
- Install TensorFlow with pip — the official installation guide, including the GPU routes.
- TensorFlow 2.22.0 release notes — what's new, and the TensorBoard change.
- Managing dependencies — how
uv addrecords packages.
