
Mamba
March 2, 2026
"Time crumbles things; everything grows old and is forgotten under the power of time."
— Aristotle
mamba环境管理
STalign
- ST配准
Faxai
mamba create -n Faxai -c conda-forge --override-channels python=3.11 scanpy pandas jupyterlab ipykernel -y
mamba activate Faxai
python -m ipykernel install --user --name faxai --display-name "Py311 Faxai"
pip install glasbey- 单细胞数据的基础分析
mamba activate Faxai
mamba install -c conda-forge -c bioconda --strict-channel-priority r-base=4.4 r-cli r-crayon r-hdf5r r-matrix r-r6 r-rlang r-seurat r-seuratobject r-stringi r-withrRscript -e 'install.packages("remotes", repos="https://cloud.r-project.org")'
R CMD INSTALL /home1/chenzhh/package/R/seurat-disk-master
# Test
Rscript -e 'library(SeuratDisk); cat("SeuratDisk version:", as.character(packageVersion("SeuratDisk")), "\n")'
Rscript -e 'library(SeuratDisk); sessionInfo()'
mamba install r-irkernel -y
mamba install -y -c conda-forge -c bioconda --strict-channel-priority r-data.table r-dplyr r-ggplot2 r-patchwork r-ggalluvial r-stringr r-forcats r-tibble \
bioconductor-biomart bioconductor-zellkonverter bioconductor-singlecellexperiment# install.packages("IRkernel", repos="https://cloud.r-project.org")
IRkernel::installspec(user = TRUE, name = "faxai-r", displayname = "R453 Faxai")
q()Rebuild 重建
现在如果迁移成功的话,我们账号通过最新的10.190.xxx.xxx登录节点之后,应该得到下面的结果:
pwd输出为:
/home1/chenzhh而请注意,
pwd -P输出为:
/cwStorage/home/chenzhh其中:
$HOME 是你登录环境里的家目录写法
pwd -P 会给你当前目录的物理路径
基础配置(mamba安装、jupyter的启动)
〇查看架构
uname -m
arch
#任选其一①下载
wget https://github.com/conda-forge/miniforge/releases/download/26.1.1-3/Miniforge3-26.1.1-3-Linux-x86_64.sh
# 或者本地下载再传到服务器上
echo "b25b828b702df4dd2a6d24d4eb56cfa912471dd8e3342cde2c3d86fe3dc2d870 Miniforge3-26.1.1-3-Linux-x86_64.sh" | sha256sum -c -②运行安装脚本
#因为过于熟悉,咱们直接非交互式安装了就💦
bash Miniforge3-26.1.1-3-Linux-x86_64.sh -b -p "$HOME/miniforge3"③check step 1:
验证conda可以使用
source "$HOME/miniforge3/etc/profile.d/conda.sh"
conda activate④写入~/.bashrc
# ~/miniforge3/bin/conda init bash
上一步骤并非必须,因为conda确实能够被mamba平替,以及实践操作下来,下面的步骤完成以后一样可以使用conda
export MAMBA_ROOT_PREFIX="$PREFIX"
"$PREFIX/bin/mamba" shell init -s bash -r "$MAMBA_ROOT_PREFIX"⑤check step 2:
新打开一个终端:
echo "$MAMBA_ROOT_PREFIX"
which mamba
mamba info没有报错则说明安装成功
⑥附:更新.condarc
mamba config list --sources应该会得到类似输出:
channels:
- conda-forge # '/cwStorage/home/chenzhh/miniforge3/.condarc'
mirrored_channels:
conda-forge:
- https://conda.anaconda.org/conda-forge # '/cwStorage/home/chenzhh/miniforge3/.condarc'
- https://prefix.dev/conda-forge # '/cwStorage/home/chenzhh/miniforge3/.condarc我的建议是统一存储在~/.mambarc
conda config --file ~/.mambarc --set show_channel_urls true然后
cat > ~/.mambarc <<'YAML'
channels:
- conda-forge
- bioconda
- nvidia
channel_priority: strict
show_channel_urls: true
YAML
# 清理索引缓存,让新源立即生效
conda clean -i -y就大功告成了
⑦附:重新搭建Jupyter
安装&基础配置生成
mamba activate base
mamba install jupyter -y
jupyter server --generate-config
# Writing default config to: '/cwStorage/home/chenzhh/.jupyter/jupyter_server_config.py'设置密码
jupyter server password
# Enter password:
# Verify password:查看当前运行的jupyter
jupyter server list
# Currently running servers:
# http://localhost:1224/ :: /cwStorage/home/chenzh关掉
jupyter server stop 1224启动
nohup jupyter lab --config="$HOME/.jupyter/jupyter_server_config.py" \
> "$HOME/jupyter_log/log_jupyter_1224_$(hostname).log" 2>&1 &⑧~/.condarc
# ~/.condarc
channels:
- defaults
- conda-forge
channel_priority: flexiblemamba 环境迁移
起因:某个大傻纸把所有的cfff上所有的mamba环境都安装在/home下面了;但后面要使用HPC的时候,只能调用/cpfs01/projects-HDD/cfff-afe2df89e32e_HDD/目录下的内容,因此导致需要将mamba环境迁移到后面的目录中
操作
SRC=/home/zy_22111220045/miniconda3/envs/scenicplus
DEST=/cpfs01/projects-HDD/cfff-afe2df89e32e_HDD/zy_22111220045/Env/scenicplus
mkdir -p "$(dirname "$DEST")"
conda create --prefix "$DEST" --clone "$SRC" --copy -y
# find "$DEST" -type d -name "__pycache__" -prune -exec rm -rf {} +
# grep -R "/home/zy_22111220045/miniconda3/envs/scenicplus" -n "$DEST/bin" | head
# grep -RIn --binary-files=without-match "/home/zy_22111220045/miniconda3/envs/scenicplus" "$DEST/bin" | head其中
conda create:创建一个新环境。
--prefix "$DEST"(等价 -p "$DEST"):把新环境创建在这个绝对路径。
--clone "$SRC":从现有本地环境复制一份到新环境(尽量做到“同一个环境的拷贝”)。
--copy:安装/落盘时用复制,而不是硬链接/软链接(跨文件系统时更稳,尤其你从 /home 到 /cpfs01)。
-y:自动回答 yes
使用的时候便可以:
conda activate /cpfs01/projects-HDD/cfff-afe2df89e32e_HDD/zy_22111220045/Env/scenicplus
