scGPT安装第三版

  1. 开启趋动云服务器,选择torch13.1 cuda11.7的版本

  2. 使用进入scgpt的源码目录,在pyproject.toml中设置pip下载的优先源:

    [[tool.poetry.source]]
    name = "qudonghua"
    url = "https://pypi.virtaicloud.com/repository/pypi/simple"
    priority = "primary"
    
  3. 将趋动云的pip和conda换源为趋动云本地源;

    pip config set global.index-url https://pypi.virtaicloud.com/repository/pypi/simple
    pip3 config get global.index-url
    
    conda config --add default_channels https://conda.virtaicloud.com/repository/anaconda/main
    conda config --add default_channels https://conda.virtaicloud.com/repository/anaconda/r
    conda config --add default_channels https://conda.virtaicloud.com/repository/anaconda/msys2
    conda config --set custom_channels.conda-forge https://conda.virtaicloud.com/repository/cloud
    
  4. cudnn jax jaxlib的安装

    # 使用mamba安装会更快速,jax,jaxlib是google开发的用于计算加速的库,其取代numpy
    conda install mamba -c conda-forge
    mamba install cudnn==8.2.* -c conda-forge
    pip install --upgrade jax==0.3.15 jaxlib==0.3.15+cuda11.cudnn82 optax==0.1.2 -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
    

    jax,jaxlib安装时要注意到的地方: JAX安装过程中遇到的各种坑_python_xiaomianyuan-开放原子开发者工作坊 (csdn.net)

  5. 使用mamba下载r-base,r-devtools

    mamba install -c conda-forge r-base r-devtools
    
  6. 使用pip 安装 packaging,flash-attn==1.0.4 --no-build-isolation

    pip install packaging ninja
    pip install flash-attn==1.0.4 --no-build-isolation 
    
    # pip install flash-attn==1.0.4 --no-build-isolation 安装失败时,
    # 可尝试以下命令
    micromamba  install -c conda-forge compilers=1.2.0
    
  7. 使用pip安装在固定torch,jax,jaxlib,torchmetrics,numpy,optax版本的情况下,安装scvi-tools及其依赖(mamba安装这个会导致pytorch重新安装)

    # 安装 scvi-tools 及其依赖项
    pip install torch==1.13.0+cu117 jax==0.3.15 jaxlib==0.3.15+cuda11.cudnn82 numpy==1.21.6 torchmetrics==0.9.1 optax==0.1.2 tensorboard==2.8.0 orbax==0.1.0 scanpy==1.9.1 scvi-tools==0.16.4 cell-gears==0.0.2 datasets==2.3.2 scib==1.0.3 torchtext pandas==1.3.5 numba==0.55.2 matplotlib==3.6 scikit-misc statsmodels anndata scipy tqdm h5py docrep flax ipywidgets numpyro openpyxl pyro-ppl pytorch-lightning rich protobuf wandb pytest transformers einops cellxgene_census
    
    
    
  8. 额外安装scgpt以及其他库

    pip install --no-deps scgpt
    
    

到此安装完成

了解 poetry的安装及使用流程

  1. 安装poetry

    pip install poetry 
    
  2. poetry.lock文件更新

    poetry lock --no-update
    
  3. 在源码根目录下使用 poetry install 安装其他依赖

    poetry install 
    
import torch
print(torch.cuda.is_available())  # 应输出 True
if torch.cuda.is_available():
    print(torch.cuda.current_device())  # 应输出当前 CUDA 设备的索引
    print(torch.cuda.get_device_name(torch.cuda.current_device()))  # 应输出当前 CUDA 设备的名称

micromamba install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.7 cuda-nvcc=11.7 cudnn==8.2.* -c pytorch -c nvidia -c conda-forge
posted @ 2024-05-26 19:20  wuhaoliu  阅读(79)  评论(2)    收藏  举报  来源