AI开发平台ModelArts-将Notebook的Conda环境迁移到SFS磁盘:保存并共享虚拟环境

时间:2025-01-26 10:50:48

保存并共享虚拟环境

将要迁移的虚拟环境打包。

# shellpip install conda-packconda pack -n sfs-clone-env -o sfs-clone-env.tar.gz --ignore-editable-packages
Collecting packages...Packing environment at '/home/ma-user/work/envs/user_conda/sfs-clone-env' to 'sfs-clone-env.tar.gz'[########################################] | 100% Completed |  3min 33.9s

解压到SFS目录。

# shellmkdir /home/ma-user/work/envs/user_conda/sfs-tar-envtar -zxvf sfs-clone-env.tar.gz -C /home/ma-user/work/envs/user_conda/sfs-tar-env

查看现有的conda虚拟环境。

# shellconda env list
# conda environments:#base                     /home/ma-user/anaconda3PyTorch-1.8           *  /home/ma-user/anaconda3/envs/PyTorch-1.8python-3.7.10            /home/ma-user/anaconda3/envs/python-3.7.10sfs-clone-env            /home/ma-user/work/envs/user_conda/sfs-clone-envsfs-new-env              /home/ma-user/work/envs/user_conda/sfs-new-envsfs-tar-env              /home/ma-user/work/envs/user_conda/sfs-tar-envtest-env                 /home/ma-user/work/envs/user_conda/test-env
support.huaweicloud.com/bestpractice-modelarts/modelarts_10_0141.html