alphafold_singularity icon indicating copy to clipboard operation
alphafold_singularity copied to clipboard

Update for AlphaFold 3

Open prehensilecode opened this issue 1 year ago • 2 comments

AlphaFold is fully open source starting with version 3.

Update this recipe for it.

prehensilecode avatar Nov 12 '24 15:11 prehensilecode

I am attempting to write the apptainer/singularity definition file to use Alphafold3 with this:

Bootstrap: docker
From: nvidia/cuda:12.6.0-base-ubuntu22.04

%environment
  export PATH="/hmmer/bin:/alphafold3_venv/bin:$PATH"

%post

  apt update --quiet \
    && apt install --yes --quiet software-properties-common \
    && apt install --yes --quiet git wget

  add-apt-repository ppa:deadsnakes/ppa \
    && DEBIAN_FRONTEND=noninteractive apt install --yes --quiet python3.11 python3-pip python3.11-venv python3.11-dev wget git

  python3.11 -m venv /alphafold3_venv

  mkdir /hmmer_build /hmmer ; \
    wget http://eddylab.org/software/hmmer/hmmer-3.4.tar.gz --directory-prefix /hmmer_build ; \
    (cd /hmmer_build && tar zxf hmmer-3.4.tar.gz && rm hmmer-3.4.tar.gz) ; \
    (cd /hmmer_build/hmmer-3.4 && ./configure --prefix /hmmer) ; \
    (cd /hmmer_build/hmmer-3.4 && make -j8) ; \
    (cd /hmmer_build/hmmer-3.4 && make install) ; \
    (cd /hmmer_build/hmmer-3.4/easel && make install) ; \
    rm -R /hmmer_build

  mkdir /app/
  cd /app/
  git clone https://github.com/google-deepmind/alphafold3.git

  cd /app/alphafold3
  pip3 install  -r dev-requirements.txt
  pip3 install  --no-deps .
  build_data

%runscript
  python3 /app/alphafold3/run_alphafold.py "$@"

However, I am running into this error:

Collecting jax>=0.4.27
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
    jax>=0.4.27 from https://files.pythonhosted.org/packages/62/20/6c57c50c0ccc645fea1895950f1e5cd02f961ee44b3ffe83617fa46b0c1d/jax-0.4.35-py3-none-any.whl#sha256=fa99e909a31424abfec750019a6dd36f6acc18a6e7d40e2c0086b932cc351325 (from chex==0.1.87->-r dev-requirements.txt (line 15))
FATAL:   While performing build: while running engine: exit status 1

After googling, I found that you can add the --use-deprecated=legacy-resolver to the pip3 install lines in post section, but then get this error:

+ pip3 install --use-deprecated=legacy-resolver --no-deps .
Processing /app/alphafold3
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
ERROR: Package 'alphafold3' requires a different Python: 3.10.12 not in '>=3.11'

I also tried to build via Docker on the GitHub (see https://github.com/google-deepmind/alphafold3/blob/main/docs/installation.md#running-using-singularity-instead-of-docker) but the docker build does not seem to work either with this error:

61.06 ERROR: Ignored the following versions that require a different python version: 0.1.2 Requires-Python <3.10,>=3.7; 0.1.3 Requires-Python <3.11,>=3.7; 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 1.7.2 Requires-Python >=3.7,<3.11; 1.7.3 Requires-Python >=3.7,<3.11; 1.8.0 Requires-Python >=3.8,<3.11; 1.8.0rc1 Requires-Python >=3.8,<3.11; 1.8.0rc2 Requires-Python >=3.8,<3.11; 1.8.0rc3 Requires-Python >=3.8,<3.11; 1.8.0rc4 Requires-Python >=3.8,<3.11; 1.8.1 Requires-Python >=3.8,<3.11
61.06 ERROR: Could not find a version that satisfies the requirement triton==3.1.0 (from versions: none)
61.06 ERROR: No matching distribution found for triton==3.1.0
61.23
61.23 [notice] A new release of pip is available: 24.0 -> 24.3.1
61.23 [notice] To update, run: pip install --upgrade pip
------
Dockerfile:44
--------------------
  42 |
  43 |     # Install the Python dependencies AlphaFold 3 needs.
  44 | >>> RUN pip3 install -r dev-requirements.txt
  45 |     RUN pip3 install --no-deps .
  46 |     # Build chemical components database (this binary was installed by pip).
--------------------
ERROR: failed to solve: process "/bin/sh -c pip3 install -r dev-requirements.txt" did not complete successfully: exit code: 1

Sorry for the lengthy post, and no resolution, but just wanted to put all the information I had. Hope this helps, thank you!

aharral avatar Nov 12 '24 15:11 aharral

For anyone hitting the require-hashes pip error, the solution is to update pip to a more recent version: https://github.com/google-deepmind/alphafold3/issues/20#issuecomment-2475114061

Luthaf avatar Nov 18 '24 14:11 Luthaf