scGPT的环境配置
第一步:确认自己的GPU和cuda版本
使用命令nvidia-smi
可以查看自己的GPU型号及cuda版本
我的相关信息如下:
GPU型号为3090,cuda版本为12.2。
第二步:创建conda环境
首先为服务器配置好科学上网,如何配置见之前的文章(),scgpt的github需求Python >= 3.7.13,这里我使用3.10进行后续的环境配置。
conda create -n sctest python=3.10
conda activate sctest
第三步:安装torch
从torch的往期版本界面(https://pytorch.org/get-started/previous-versions/) 找到1.13.0版本,并使用pip安装,我的cuda版本是12.2,这里选择11.7的版本安装。
pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117
第四步:安装其他的依赖项
jaxlib&jax
jax的依赖需要选择适合自己的版本,通过网站查找适合自己的python版本和cudnn版本的jax。
pip install jaxlib==0.4.6+cuda11.cudnn86 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
pip install jax==0.4.6
pip install scikit-misc statsmodels anndata scipy tqdm h5py
pip install docrep flax ipywidgets numpyro openpyxl pyro-ppl pytorch-lightning rich protobuf
pip install wandb pytest transformers einops cellxgene_census
pip install flash-attn==1.0.4 --no-build-isolation
pip install --no-deps scgpt
pip install poetry
jupyter内核
pip install ipykernel
scvi内核
由于版本冲突,输入以下命令后会对其他版本的包产生冲突,但最终是可用的。
pip install scvi-tools==0.16.4 anndata==0.7.8 scanpy==1.9.3 mudata==0.2.1 scgpt==0.2.1
检查最终的版本
pip list | grep -E "anndata|scanpy|mudata|scvi|torch|jax"
所有冲突包的正确版本信息如下所示
包 | 版本 |
---|---|
anndata | 0.7.8 |
jax | 0.4.35 |
jaxlib | 0.4.35 |
mudata | 0.3.1 |
pytorch-lightning | 1.5.10.post0 |
scanpy | 1.11.0 |
scvi-tools | 0.16.4 |
torch | 2.1.2 |
torchaudio | 0.13.0+cu117 |
torchdata | 0.7.1 |
torchmetrics | 1.6.2 |
torchtext | 0.16.2 |
torchvision | 0.14.0+cu117 |