Installing TensorFlow & Keras

Deep Learning with Keras and TensorFlow 10 min min read Updated: Nov 16, 2026 Beginner
Installing TensorFlow & Keras
Beginner Topic 4 of 7

Choose Your Setup

OptionBest ForSetup Time
Google ColabBeginners, free GPU, nothing to install1 minute
Local with pipWorking offline, full control10 minutes
Local with GPUFaster training of large models30+ minutes

Option 1: Google Colab (Easiest)

  1. Open Google Colab in your browser and sign in with a Google account.
  2. Click New notebook.
  3. To enable a free GPU: Runtime > Change runtime type > GPU.
  4. TensorFlow and Keras are already installed. Type import keras in a cell and run it.

Option 2: Install on Your Computer

Use a recent 64-bit version of Python (check the TensorFlow website for the currently supported versions). Always create a virtual environment so that packages do not conflict with other projects.

bash # 1. Create a virtual environment python -m venv dl-env # 2. Activate it # Windows: dl-env\Scripts\activate # Mac / Linux: source dl-env/bin/activate # 3. Upgrade pip and install the packages pip install --upgrade pip pip install tensorflow keras numpy pandas matplotlib scikit-learn jupyter
Why a virtual environment? It is like a clean, separate toolbox for each project. If one project needs another version of a library, nothing breaks.

Step 3: Test the Installation

python import tensorflow as tf import keras print("TensorFlow:", tf.__version__) print("Keras:", keras.__version__) # Tiny test: add two tensors a = tf.constant([1.0, 2.0]) b = tf.constant([3.0, 4.0]) print(a + b)
Result

tf.Tensor([4. 6.], shape=(2,), dtype=float32)

Optional: GPU Support

A GPU can make training many times faster. It requires an NVIDIA graphics card and a driver installed on your computer. On Linux you can install the CUDA libraries together with TensorFlow using pip:

bash pip install "tensorflow[and-cuda]"
python import tensorflow as tf print(tf.config.list_physical_devices("GPU"))

If the list is empty, TensorFlow is using the CPU. That is completely fine for the small examples in this course.

Windows users: Recent TensorFlow versions do not support GPU on native Windows. If you want a local GPU on Windows, use WSL2 (Windows Subsystem for Linux). For learning, Google Colab is the simplest choice.

Run Jupyter Notebook

bash jupyter notebook

Create a new Python notebook. Each cell can be run separately with Shift + Enter, which is great for learning step by step.

Common Problems

ProblemSolution
No matching distribution foundYour Python version may not be supported. Use a supported version in a new virtual environment
ModuleNotFoundError: No module named 'keras'Activate the virtual environment and run pip install keras
Many warnings about CUDA or oneDNNThese are information messages. You can ignore them when training on CPU
Slow installUpgrade pip and check your internet connection

Conclusion

With Colab you can start in a minute. A local setup with a virtual environment is better for bigger projects. Either way, test with the small program above.

Quick Summary: Use Colab or a venv with pip install tensorflow keras. Verify by printing the versions and adding two tensors.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators