安装mamba 以及打包并迁移环境

2024-06-10  本文已影响0人  余绕

1. 创建文件夹

mkdir mamba

2.下降mamba文件

curl -L https://micro.mamba.pm/api/micromamba/linux-64/latest -o micromamba.tar.bz2

3. 解压

tar -xvjf micromamba.tar.bz2

4.配置环境变量

 ./micromamba shell init -s bash -p /public/home/ypyue/mamba/
or 
./micromamba shell init -s bash -p /public/home/ypyue/mamba/bin/

source  .bashrc

5. 设置源,将以下内容保存到~/.mambarc 即可。

channels:
- defaults
show_channel_urls: true
default_channels:
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
 conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
 simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud


补加两个channel: 
micromamba config append channels conda-forge
micromamba config append channels bioconda

创建环境 python=2.7 并安装软件

micromamba create -n ChIP-seq  python=2.7
micromamba activate mamba/envs/ChIP-seq/
 micromamba  install fastp


打包conda环境

1. 用 conda-pack 打包环境 (pack 命令可以pip安装)

conda pack -n R3.5  -o  R35.1.tar.gz

2. 解压环境

在env 目录下创建一个目录(直接mkdir创建不需要micromamba or conda 创建环境),解压这个打包的环境到一个指定的目录:

mkdir R3.5  
tar -xzvf ../../R35.1.tar.gz -C ./R3.5/

(R3.5) (base) [ypyue@login02 envs]$ ls
R3.5

3. 设置环境变量

在解压后的环境中,运行 conda-unpack 来修正路径:

pwd 
/public/home/ypyue/mamba/envs  #找出完整路径

source /public/home/ypyue/mamba/envs/R3.5/bin/activate #激活环境
conda-unpack #修正路径 非常重要不然报错。
上一篇 下一篇

猜你喜欢

热点阅读