lsb_release -a- Should show Ubuntu 22.04 or higher.
nvidia-smi
- Should show:
- GPU (e.g.,
RTX 4090) - Driver Version (e.g.,
535.183.01) - CUDA Version (e.g.,
12.2)
- GPU (e.g.,
If nvidia-smi is not found, install NVIDIA drivers:
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
sudo reboot
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
Add Docker’s GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
Add repository:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Add user to docker group (so you can run docker without sudo):
sudo usermod -aG docker $USER
(Log out and back in, or reboot, for the group changes to take effect.)
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container.gpg] https://#' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
mkdir -p ~/Repositories/alphafold
cd ~/Repositories/alphafold
mkdir af_input af_output af_weights public_databasesgit clone https://github.com/google-deepmind/alphafold3.git
Move the weights to the af_weights directory
# Install zstd if not already installed
sudo apt-get install zstd
# Decompress the weights
cd af_weights
zstd -d weights.bin.zst
cd ~/alphafold/alphafold3
# Make sure is executable
chmod +x fetch_databases.sh
# Define the directory
./fetch_databases.sh ~/thesis/public_databases
To see the download progress modify the file ./fetch_databases.sh :
# wget --quiet --output-document=- \
wget --progress=bar:force --output-document=- \
# wget --quiet --output-document=- "${SOURCE}/${NAME}.zst" | \
wget --progress=bar:force --output-document=- "${SOURCE}/${NAME}.zst" | \
cd ~/alphafold/af_input
nano fold_input.json
Paste the following
{
"name": "2PV7",
"sequences": [
{
"protein": {
"id": ["A", "B"],
"sequence": "GMRESYANENQFGFKTINSDIHKIVIVGGYGKLGGLFARYLRASGYPISILDREDWAVAESILANADVVIVSVPINLTLETIERLKPYLTENMLLADLTSVKREPLAKMLEVHTGAVLGLHPMFGADIASMAKQVVVRCDGRFPERYEWLLEQIQIWGAKIYQTNATEHDHNMTYIQALRHFSTFANGLHLSKQPINLANLLALSSPIYRLELAMIGRLFAQDAELYADIIMDKSENLAVIETLKQTYDEALTFFENNDRQGFIDAFHKVRDWFGDYSEQFLKESRQLLQQANDLKQG"
}
}
],/
"modelSeeds": [1],
"dialect": "alphafold3",
"version": 1
}
cd alphafold3
nano docker/DockerfileChange the line 12 to:
CUDA Drivers > 535 on Ubuntu Desktop are unstable; on a server, update to a newer version (545 or 550) that supports CUDA 12.6 to avoid this modification.
# FROM nvidia/cuda:12.6.0-base-ubuntu22.04
FROM nvidia/cuda:12.2.0-base-ubuntu22.04
Change the line 52 to:
# RUN pip3 install -r dev-requirements.txt
RUN pip3 install --retries 3 --default-timeout=200 -r dev-requirements.txt || \
pip3 install --retries 3 --default-timeout=200 -r dev-requirements.txt
Clean existing installations (optional housekeeping):
# 1. Container Management
docker ps # List running containers
docker ps -a # List ALL containers (running and stopped)
docker stop $(docker ps -a -q) # Stop all running containers
docker rm $(docker ps -a -q) # Remove all containers
# 2. Image Cleanup
docker images # List all images
docker rmi alphafold3 # Remove AlphaFold 3 image
docker rmi $(docker images -q) # (Optional) Remove ALL images
# 3. System Cleanup
docker system prune -f # Remove unused data (stopped containers, unused networks)
docker system prune -a -f # (Optional) More aggressive cleanup (includes unused images)
# 4. Volume Cleanup (Optional - be careful!)
docker volume ls # List volumes
docker volume prune -f # Remove unused volumesVerify cleanup:
docker ps -a # Should show no containers
docker images # Should show no alphafold3 image
Build new image:
docker build --network=host -f docker/Dockerfile -t alphafold3 .
docker run --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi
-
* Error: “could not select device driver with capabilities: \[\[gpu\]\]”- Solution: Install
nvidia-container-toolkitand configure Docker.
- Solution: Install
docker run --gpus all alphafold3 python -c "import jax; print(jax.devices())"
- Result 🟢:
[CudaDevice(id=0)]
docker run --gpus all alphafold3 python run_alphafold.py --help
After setup, run predictions with:
docker run -it \
--volume ~/Repositories/alphafold/af_input:/root/af_input \
--volume ~/Repositories/alphafold/af_output:/root/af_output \
--volume ~/Repositories/alphafold/af_weights:/root/models \
--volume ~/Repositories/alphafold/public_databases:/root/public_databases \
--gpus all \
alphafold3 \
python run_alphafold.py \
--json_path=/root/af_input/fold_input.json \
--model_dir=/root/models \
--output_dir=/root/af_outputRemember:
- Place model weights in
af_weightsdirectory. - Place databases in
public_databasesdirectory. - Create input JSON files in
af_inputdirectory. - Results will appear in
af_outputdirectory.