前言
机器学习的各种软件版本对应真的是深度学习初学者(我)的一生之敌啊,继上一次部署了一周的colabfold后,如今我又开始和esmfold的安装在掰头了,还好这次只花了两天就取得了阶段性胜利。本文主要记录一下配置的全流程以及主要问题的解决。
关键词
esmfold安装全流程,GPU配置和部署,github克隆和安装
主要参考
1. https://blog.csdn.net/weixin_40192882/article/details/136178381/
2. https://github.com/facebookresearch/esm/
3. https://github.com/aqlaboratory/openfold/tree/f434a2786b5a6b39171f358fb3470ad9f4fd2a58/
一、conda配置esmfold基础环境
step1. 将以下内容保存为:conda_environment.yml
name: esmfold
channels:
- conda-forge
- bioconda
- pytorch
dependencies:
- conda-forge::python=3.7
- conda-forge::setuptools=59.5.0
- conda-forge::pip
- conda-forge::openmm=7.5.1
- conda-forge::pdbfixer
- conda-forge::cudatoolkit==11.3.*
- conda-forge::cudatoolkit-dev==11.3.*
- conda-forge::einops==0.6.1
- conda-forge::fairscale
- conda-forge::omegaconf
- conda-forge::hydra-core
- conda-forge::pandas
- conda-forge::pytest
- bioconda::hmmer==3.3.2
- bioconda::hhsuite==3.3.0
- bioconda::kalign2==2.04
- pytorch::pytorch=1.12.*
step2. 构建conda环境
conda env create -f conda_environment.yml ##创建esmfold环境
step3. 检查conda安装包的版本号
conda env list ##查看刚构建的conda环境
conda activate esmfold ##进入构建的conda环境
conda list ##列出此conda环境的所有软件包
step4. 将以下内容保存为:pip_requirements.txt
biopython==1.79
deepspeed==0.5.9
dm-tree==0.1.6
ml-collections==0.1.0
numpy==1.21.2
PyYAML==5.4.1
requests==2.26.0
scipy==1.7.1
tqdm==4.62.2
typing-extensions==3.10.0.2
pytorch_lightning==1.5.10
wandb==0.12.21
biotite==0.39.0
matplotlib
joblib
step5. pip更新安装包版本
pip install -r pip_requirements.txt
二、esmfold安装
按照官网教程,下一步就应该跑这几个pip
,然后就完美收官了!BUT!以我半年来装带显卡的深度学习软件经验来看,配置可能还会和本机原有配置冲突,果不其然,openfold就是怎么也装不上。
pip install fair-esm # latest release,OR
pip install git+https://github.com/facebookresearch/esm.git # bleeding edge, current repo main branch
pip install "fair-esm[esmfold]"
# OpenFold and its remaining dependency
pip install 'dllogger @ git+https://github.com/NVIDIA/dllogger.git'
pip install 'openfold @ git+https://github.com/aqlaboratory/openfold.git@4b41059694619831a7db195b7e0988fc4ff3a307'
如果有小伙伴在这一步就完美通关了,恭喜你,可以直接跳过第三部分openfold的曲折安装直接调用程序了!
三、openfold安装
由于实在不清楚git+https://github.com/aqlaboratory/openfold.git@4b41059694619831a7db195b7e0988fc4ff3a307是openfold的哪个版本号,所以下文安装的是目前最新的openfold
v 2.1.0
step1:克隆openfold并安装
https://blog.csdn.net/qq_45961101/article/details/130384117
https://blog.csdn.net/weixin_44789022/article/details/138523343
git clone --depth=1 https://github.com/aqlaboratory/openfold.git
cd openfold/
pip install -e . ##安装
step2:mkl版本问题:‘undefined symbol: iJIT_NotifyEvent’
https://blog.csdn.net/mr_hore/article/details/138961434
解决方法:对mkl进行降级
conda uninstall mkl
conda install mkl=2018 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
step3:pytorch+gcc+cuda对应问题
提供一下我多次尝试安装成功的配置(网上也有很多提到配置pytorch和cuda配置的问题,但忽视了gcc的配置):pytorch1.12.1+cuda11.3+cudnn8.9+gcc7
##cuda和cudnn只能在nvidia下载,conda下载cuda环境对openfold不管用
#https://blog.csdn.net/ksws0292756/article/details/80120561
##conda下载gcc和gxx
conda install -c moussi gcc_impl_linux-64=7.3.0
conda install -c moussi gxx_impl_linux-64=7.3.0
cd /home/line2/anaconda3/envs/esmfold_env/bin
##链接到gcc和gxx(进入自己的bin看叫gcc和gxx什么名字)
ln -s ./x86_64-conda_cos6-linux-gnu-gcc ./gcc
ln -s ./x86_64-conda_cos6-linux-gnu-g++ ./g++
到此为止,在自己的conda环境下检查cuda和gcc应该都是对应新安装的版本
nvcc -V ##cuda版本
gcc -v ##gcc版本
step4:torch-gpu未安装
解决办法:安装对应的torch
https://pytorch.org/get-started/previous-versions/
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 -f https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
四、成功调用
总结
世上无难事,只怕有心人。