C.W.K.
Stream
Lesson 07 of 07 · published

Installation & Setup

~12 min · origin

Level 0Keras Apprentice
0 XP0/97 lessons0/20 achievements
0/120 XP to next level120 XP to go0% complete

Backend first, then Keras

Getting started with Keras 3 is a two-step install, and the order matters. Keras itself is pure Python — no compiled extensions, and it doesn't pull in CUDA. The backend brings the GPU stack. So install your backend first (TensorFlow, PyTorch, or JAX), confirm its GPU detection on its own, and only then layer Keras on top. That separation is exactly why Keras 3 stays small and installs in seconds (first Code block).

Once it's installed, set your backend before the first import keras — the KERAS_BACKEND environment variable is the switch (second Code block).

Code

Install Keras 3 + your backend·python
# Install Keras
pip install keras

# Install your preferred backend
pip install tensorflow    # TensorFlow backend
pip install jax jaxlib    # JAX backend
pip install torch         # PyTorch backend
Pick the backend before importing Keras·python
import os
os.environ["KERAS_BACKEND"] = "jax"  # Must be set BEFORE import keras
import keras

# Or check/set programmatically (Keras 3.5+):
keras.config.set_backend("torch")
print(keras.backend.backend())  # → "torch"

External links

Exercise

Set up a clean conda env. Install Keras + your backend of choice. Verify GPU detection (keras.config.backend() and the backend's own GPU check). Save the working pip freeze as a project-template requirements.txt.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.