scGPT Learning Diary
scGPT Learning Diary
1. Installing the New Version of scGPT
Reference link: cambridge-ceu The first of the two methods uses py311 and torch 2.x; the second method’s 3.9 doesn’t work with 2.x.
Environment: python 3.11
1. Install torch package
Note that you need to install the torch package corresponding to your cuda version here. My cuda version is 12.4, and there are two installation methods
1. Online pytorch installation
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu1212. Local installation
cd /data/xds/Projects/PWd/SC/Tools/scGPT/packages
# (scgpt_2) ➜ packages git:(main) ✗ ls
# torch-2.3.0+cu121-cp311-cp311-linux_x86_64.whl
# torchaudio-2.3.0+cu121-cp311-cp311-linux_x86_64.whl
# torchvision-0.18.0+cu121-cp311-cp311-linux_x86_64.# whl
pip install ./*2. Install other packages
pip install packaging
pip install ipykernel
pip install scgpt3. Resolve errors
When installing the flash-attn package, I got an error about an inappropriate compiler So I followed the error message to install the appropriate version gcc = 12
mamba install gcc_linux-64=12 gxx_linux-64=12 ninja -y # Install ninjx to speed up compilation
Check installation file path
conda list | grep gcc
conda list | grep gxx
Set environment variables
export CC=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-gcc
export CXX=$CONDA_PREFIX/bin/x86_64-conda-linux-gnu-g++
pip install flash-attn==1.0.4After resolving, continue installing other packages
pip install scvi-tools==0.20.3 anndata==0.9.2 scanpy==1.9.3
pip install wandb
pip install faiss-cpu
pip uninstall numpy -y
pip install numpy==1.26
pip install gseapyCheck if packages were successfully installed and their versions
pip list | awk '/scanpy|scib|scvi|scgpt|flash_attn|torch|wandb|numpy/'# !!! Unexpected bonus
# After running this single cell command, seamlessly connect to the above, and you can get a unified environment where scgpt is also integrated.
# Never mind me, there are some small issues. Pertpy seems to have dependency issues, we'll talk about that later.
mamba create -n sc python=3.11 -y
mamba activate sc
mamba install scanpy omicverse scvi-tools pertpy scvelo scikit-image -y