AI and Artificial-Life Tools on Linux
Set up open-source AI/ML and artificial-life toolkits on Linux: PyTorch, JAX, DEAP, Avida, NetLogo, and RL environments with GPU driver guidance.
Before you start
- ▸64-bit Linux install with kernel 5.15 or newer
- ▸Python 3.10+ available (python3 --version)
- ▸sudo / root access for driver and package installation
- ▸For GPU work: NVIDIA (Turing/Ampere/Ada) or AMD RDNA2+ discrete GPU
Linux has always been the natural habitat for AI and computational biology research. Whether you are running modern deep-learning workloads on NVIDIA hardware, evolving neural architectures with genetic algorithms, or simulating artificial ecosystems, every serious open-source framework runs best—or only—on Linux. This guide walks through setting up and validating the major stacks, from classic a-life simulators to PyTorch and JAX, with concrete commands for each major distro family.
Prerequisites and System Baseline
Before installing anything, confirm your kernel and driver situation. GPU-accelerated frameworks require a relatively recent kernel (5.15+ is fine; 6.x is better) and, for NVIDIA cards, the proprietary driver. AMD GPUs use the open ROCm stack. CPU-only work needs nothing special beyond a 64-bit install and Python 3.10+.
uname -r
python3 --version
lscpu | grep -E 'Model name|CPU\(s\)|Thread'
nvidia-smi # NVIDIA only — will fail cleanly if no GPU present
Python Environment Strategy
Do not install AI/ML libraries into the system Python. Every major framework pins transitive dependencies aggressively and will break your distro packages. Use isolated virtual environments per project, or conda/mamba when you need compiled CUDA kernels managed for you.
Option A — venv (lightweight, always available)
python3 -m venv ~/.venvs/ailab
source ~/.venvs/ailab/bin/activate
pip install --upgrade pip setuptools wheel
Option B — Miniforge (recommended for GPU work)
curl -fsSLo miniforge.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash miniforge.sh -b -p "$HOME/miniforge3"
"$HOME/miniforge3/bin/conda" init bash
source ~/.bashrc
conda create -n ailab python=3.11 -y
conda activate ailab
NVIDIA CUDA Driver Setup
The proprietary driver is the single most common stumbling block. On all three families the procedure is: disable Nouveau, install the driver package, then verify with nvidia-smi.
Debian / Ubuntu
sudo apt update
sudo apt install -y linux-headers-$(uname -r) software-properties-common
sudo add-apt-repository contrib # Debian only
sudo apt install -y nvidia-driver firmware-misc-nonfree # Debian
# Ubuntu: ubuntu-drivers autoinstall OR apt install nvidia-driver-545
Fedora / RHEL / Rocky
# Add RPM Fusion
sudo dnf install -y \
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install -y akmod-nvidia xorg-x11-drv-nvidia-cuda
sudo systemctl reboot
Arch
sudo pacman -S --needed nvidia nvidia-utils cuda cudnn
sudo systemctl reboot
After reboot, verify the driver loaded and check compute capability:
nvidia-smi
nvcc --version # if cuda toolkit is installed
Modern ML Stack: PyTorch and JAX
PyTorch (CUDA)
Always install from the official index URL for the correct CUDA version. Mixing conda and pip here is safe as long as you install PyTorch last.
pip install torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121
Quick smoke test:
python3 -c "
import torch
print(torch.__version__)
print('CUDA available:', torch.cuda.is_available())
print('Device:', torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU')
"
JAX (NVIDIA)
pip install -U "jax[cuda12]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
python3 -c "import jax; print(jax.devices())"
ROCm for AMD GPUs
ROCm 6.x supports RDNA2 and newer plus most CDNA cards. Install the ROCm base stack via the official AMDGPU installer, then install PyTorch's ROCm wheel:
# After amdgpu-install --usecase=rocm from repo.radeon.com:
pip install torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/rocm6.0
Classic Genetic Programming and Evolutionary Frameworks
DEAP — Distributed Evolutionary Algorithms in Python
DEAP is the go-to library for genetic programming, evolution strategies, and multi-objective optimization (NSGA-II, SPEA2). It is pure Python and installs trivially.
pip install deap
A minimal evolving symbolic regression in one shot:
python3 - <<'EOF'
import operator, math, random
from deap import algorithms, base, creator, gp, tools
pset = gp.PrimitiveSet("MAIN", 1)
pset.addPrimitive(operator.add, 2)
pset.addPrimitive(operator.mul, 2)
pset.addPrimitive(math.sin, 1)
pset.renameArguments(ARG0="x")
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual", gp.PrimitiveTree, fitness=creator.FitnessMin)
toolbox = base.Toolbox()
toolbox.register("expr", gp.genHalfAndHalf, pset=pset, min_=1, max_=3)
toolbox.register("individual", tools.initIterate, creator.Individual, toolbox.expr)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)
def evaluate(individual):
func = toolbox.compile(expr=individual)
return (sum((func(x) - x**2)**2 for x in range(-5, 6)),)
toolbox.register("compile", gp.compile, pset=pset)
toolbox.register("evaluate", evaluate)
toolbox.register("select", tools.selTournament, tournsize=3)
toolbox.register("mate", gp.cxOnePoint)
toolbox.register("mutate", gp.mutUniform, expr=toolbox.expr, pset=pset)
pop = toolbox.population(n=100)
hof = tools.HallOfFame(1)
algorithms.eaSimple(pop, toolbox, 0.7, 0.1, 40, halloffame=hof, verbose=False)
print("Best:", hof[0])
EOF
PyGAD — Genetic Algorithms with NumPy/PyTorch Integration
pip install pygad
PyGAD has first-class support for evolving PyTorch and Keras model weights, making it practical for neuroevolution tasks without a full ES library.
Nevergrad (Meta) — Gradient-Free Optimization
pip install nevergrad
Nevergrad bundles CMA-ES, DE, PSO, and dozens of other algorithms behind a single consistent API. Useful when your fitness landscape is non-differentiable.
Artificial-Life Simulators
Avida-ED and Avida (CLI)
Avida is the canonical digital-organism evolution platform from the Pennock/Lenski group. Build from source on Debian/Ubuntu:
sudo apt install -y build-essential cmake git
git clone https://github.com/devosoft/avida.git
cd avida
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
./avida -c ../support/avida.cfg
Xentica — GPU-Accelerated Cellular Automata (Python)
pip install xentica
Xentica uses PyCUDA to run large-scale CA experiments on GPU. It requires a working CUDA install. Check their documentation for the exact PyCUDA version pin before installing.
NetLogo via OpenJDK (Agent-Based Modeling)
NetLogo is the standard for agent-based a-life models and runs fine under Linux with OpenJDK 17+.
# Debian/Ubuntu
sudo apt install -y openjdk-21-jre
wget https://ccl.northwestern.edu/netlogo/6.4.0/NetLogo-6.4.0-64.tgz
tar xzf NetLogo-6.4.0-64.tgz
cd NetLogo-6.4.0-64
./NetLogo # launches GUI; works on Wayland via XWayland
Wayland note: NetLogo's Java Swing UI runs through XWayland automatically on modern desktops. No extra flag needed on GNOME 45+ or KDE Plasma 6.
Reinforcement Learning Environments
pip install gymnasium[all] stable-baselines3 shimmy
Gymnasium (the maintained OpenAI Gym fork) plus Stable-Baselines3 gives you a complete RL sandbox. For MuJoCo physics, install the free mujoco Python package directly — the old licensing restriction is gone:
pip install mujoco
Monitoring GPU Utilization
Long-running training sessions need live resource visibility. nvtop is the best interactive monitor and handles both NVIDIA and AMD cards:
# Debian/Ubuntu
sudo apt install nvtop
# Fedora
sudo dnf install nvtop
# Arch
sudo pacman -S nvtop
nvtop
For headless servers, log GPU stats every 5 seconds with:
nvidia-smi dmon -s u -d 5
Troubleshooting
- CUDA out-of-memory on startup: Another process holds the GPU. Run
nvidia-smito find the PID and kill it, or setPYTORCH_CUDA_ALLOC_CONF=expandable_segments:Truein your environment. - Wrong CUDA version mismatch:
torch.version.cudamust match the driver's supported CUDA. Upgrade the driver or downgrade the PyTorch wheel index URL. - Avida build fails on GCC 13+: Pass
-DCMAKE_CXX_FLAGS="-Wno-error"to cmake; some deprecated C++ constructs trigger errors by default on modern GCC. - NetLogo blank window on Wayland: Force XWayland explicitly with
GDK_BACKEND=x11 ./NetLogoif auto-detection fails. - JAX sees only CPU despite GPU present: Confirm
libcuda.so.1is onLD_LIBRARY_PATH. With Miniforge:conda install -c nvidia cuda-nvccoften resolves it.
Frequently asked questions
- Can I run PyTorch GPU workloads without an NVIDIA card?
- Yes. AMD cards are supported via the ROCm backend using PyTorch's rocm wheel index. Apple Silicon is not relevant here, but on Linux x86 AMD GPUs with RDNA2 or newer work well with ROCm 6.x.
- Is Conda/Miniforge necessary, or can I just use pip?
- pip is fine for CPU-only work or when your distro ships CUDA system-wide. Miniforge is strongly preferred when you need multiple CUDA versions side by side or want NVIDIA to manage compiled kernel packages for you.
- What is the difference between DEAP and Nevergrad?
- DEAP is a flexible framework for building custom evolutionary algorithms including full genetic programming with tree-based expressions. Nevergrad is a benchmark-oriented library of pre-built gradient-free optimizers; you plug in a fitness function and pick an algorithm.
- Does Avida still see active development?
- The core Avida codebase on GitHub sees occasional maintenance commits, but active research now often uses Modular Agent-Based Evolver (MABE2) from the same Devolab group. Both build on modern Linux.
- My training job is killed by the OOM killer mid-run. How do I prevent this?
- Either reduce batch size, enable gradient checkpointing in your model, or add swap space (a swapfile of 16–32 GB helps on memory-constrained machines). Also confirm you are not loading the entire dataset into CPU RAM before batching.
Related guides
Assembly Language on Linux: A Starter Guide
Write x86-64 assembly on Linux from scratch: install NASM and GAS, learn syscalls, assemble and link a working program, then inspect and debug it.
How to Benchmark Disk Performance with fio
Learn to benchmark Linux disk performance with fio: writing job files, testing latency and throughput, and interpreting IOPS and percentile output correctly.
The Linux Boot Process Explained
Trace the full Linux boot sequence from UEFI firmware through GRUB2, the kernel, initramfs, and systemd to your login prompt — with diagnostics at each stage.
Btrfs Basics and Snapshots
Learn Btrfs subvolumes, instant copy-on-write snapshots, and safe system rollback — with both manual btrfs commands and Snapper automation.