Beginner
Installing JAX
Get JAX running on your machine with CPU, GPU (NVIDIA CUDA), or TPU support. We also cover installing the JAX ecosystem libraries you will need.
CPU-Only Installation
Bash
# CPU-only (works on all platforms)
pip install jax
GPU Installation (NVIDIA CUDA)
Bash
# GPU support with CUDA 12 pip install jax[cuda12] # Or specify CUDA version explicitly pip install jax[cuda12_pip] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
Prerequisites: For GPU support, you need an NVIDIA GPU with CUDA 12+ and cuDNN installed. Check your CUDA version with
nvcc --version.
TPU Installation (Google Cloud)
Bash
# On a TPU VM (Google Cloud)
pip install jax[tpu] -f https://storage.googleapis.com/jax-releases/libtpu_releases.html
Install the JAX Ecosystem
Bash
# Neural network libraries pip install flax # Google's neural network library for JAX pip install optax # Gradient processing and optimization # Alternative neural network library pip install dm-haiku # DeepMind's Haiku # Useful extras pip install orbax-checkpoint # Model checkpointing pip install clu # Common loop utilities
Verify Your Installation
Python
import jax import jax.numpy as jnp # Check version print(f"JAX version: {jax.__version__}") # Check available devices print(f"Devices: {jax.devices()}") # Quick test: create an array and compute x = jnp.array([1.0, 2.0, 3.0]) print(f"Sum: {jnp.sum(x)}") print(f"Device: {x.devices()}") # Test JIT compilation @jax.jit def f(x): return jnp.dot(x, x) result = f(jnp.ones(1000)) print(f"JIT works! Result: {result}")
Google Colab: The easiest way to try JAX with GPU/TPU support is Google Colab. JAX comes pre-installed - just select a GPU or TPU runtime and start coding.
Next Up: Core Concepts
Now that JAX is installed, let's dive into the core concepts: DeviceArrays, JIT compilation, automatic differentiation, and vectorization.
Next: Core Concepts →Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX