如何在linux服务器上部署conda和pytorch

安装miniconda

Login to Ibex using your KAUST credentials.

ssh $USERNAME@ilogin.ibex.kaust.edu.sa # use glogin.kaust.edu.sa if you need GPU nodes

Clone this git repository in your Ibex home directory.

cd ~/
git clone https://github.com/kaust-rccl/ibex-miniconda-install.git

Change into the newly cloned repository directory and source the install script. Sourcing the install script runs each of the commands in the script as if you had entered them manually at the prompt and insures that changes made to your ~./bashrc take effect without your having to logout of Ibex.

cd ibex-miniconda-install/
source install-miniconda.sh

The script will present several prompts that allow you to customize the Miniconda install. We generally recommend that you accept the default settings. However, when prompted with the following…

Do you wish the installer to initialize Miniconda3
by running conda init?

…we recommend that you type yes to avoid having to manually initialize Conda for Bash later.

If you accidentally type no, don’t worry. When the script finishes you simply need to type the following commands.

conda init bash
source ~/.bashrc

By default, the Conda base environment is deactivated when you login to Ibex. If you would prefer that the Conda base environment be activated on login then you can run the following command to set the auto_activate_base configuration parameter to true.

conda config --set auto_activate_base true

If you are still a little unsure about the whole process, we have created a tutorial on our YouTube channel that will walk you through the above steps in detail.

Updating Conda
Conda is a rapidly developing tool and it is important that you keep your versions on Ibex updated to the most recent version available. We have included an update-conda.sh script that will update Conda for you. Change into the ibex-miniconda-install directory and source the update script.

cd ~/ibex-miniconda-install
source update-conda.sh
Uninstalling Miniconda
Login to Ibex using your KAUST credentials.
ssh $USERNAME@ilogin.ibex.kaust.edu.sa # use glogin.kaust.edu.sa if you need GPU nodes

Change into the ibex-miniconda-install directory and source the uninstall script. Sourcing the install script insures that you don’t need to logout of Ibex in order for the changes made by the uninstaller script to take effect.

cd ~/ibex-miniconda-install/
source uninstall-miniconda.sh

Running uninstall-miniconda.sh will delete all Conda environments stored in the ~/miniconda3/envs directory.

安装pytorch环境

  1. 构建新路径放环境
mkdir pytorch_project_path
  1. 激活conda
conda activate

3.用nano构建环境配置

nano enviroment.yml

在yml文件中写如下配置

name: pytorch-env

channels:
  - pytorch
  - conda-forge
  - defaults

dependencies:
  - cudatoolkit=11.3
  - pip
  - python
  - pytorch
  - torchaudio
  - torchvision

其中toolkit的版本通过nvidia-smi查看,需要和自己的cuda版本保持一致

4.从头创建新环境

conda env create --prefix ./env --file environment.yml --force

5.激活新环境

 conda activate ./env

参考:
1:https://www.youtube.com/watch?v=X-W7aVXH3_w
2.https://github.com/kaust-rccl/ibex-miniconda-install
3.https://www.youtube.com/watch?v=cTaKR0qunZ0

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值