How to Install TensorFlow on Linux
TensorFlow is an open-source machine learning framework for building and training neural networks. This guide covers installing TensorFlow on your Breeze for CPU-based workloads.
Prerequisites
- A Breeze with at least 4 GB RAM
- Python 3.9 - 3.12
- pip package manager
Create a Virtual Environment
sudo apt update && sudo apt install python3-venv python3-pip -y
python3 -m venv ~/tf-env
source ~/tf-env/bin/activate
Install TensorFlow
pip install --upgrade pip
pip install tensorflow
Verify the Installation
python3 -c "import tensorflow as tf; print(tf.__version__)"
Install Common Companion Libraries
pip install numpy pandas scikit-learn matplotlib
Optimize for CPU
TensorFlow automatically uses available CPU optimizations. Set thread count to match your Breeze cores:
import tensorflow as tf
tf.config.threading.set_intra_op_parallelism_threads(4)
tf.config.threading.set_inter_op_parallelism_threads(4)
Memory Management
For memory-constrained environments, limit TensorFlow memory growth:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
Monitor usage with htop during training. Consider swap space for larger models as described in our LLM optimization guide.