How to customize a conda environment
To perform meaningful calculations, we have to install additional packages in our conda environment. If you don’t have a conda environment installed, refer to: How to create and activate a conda environment. Here, we restrict ourselves to a simple example. The code we are going to work with is /home/ENV-FILES/user-docu-examples/PyTorch-1_x-MNIST.ipynb. To use this code, copy it to your home directory, e.g.,
- Open a terminal and type:
cp /home/ENV-FILES/user-docu-examples/PyTorch-1_x-MNIST.ipynb /home/<username>If your are interested in other examples, refer to the
Advanced optionssection. - Once the file is in your
home/<username>directory, you can open it from this location and modify it at will. - First, check your GPU driver version to know your
CUDAlimitations. - In this example, the
Torchlibrary and theTochvisionpackage are required. Compatible versions are listed in https://download.pytorch.org/whl/torch_stable.html. - Install
PyTorch 1.10.1andTorchvision 0.11.2. To do so, activate the conda environment that you want to work with and then install the packages in it:conda activate <name> conda install pytorch==1.10.1 torchvision==0.11.2 -c pytorch -y - Once the installation is completed you can list all your packages considering
conda list - Also, you can list specific packages, e.g.,
conda list cuda -
As you can see in Fig. 1, when you installed
PyTorch 1.10.1,cudatoolkit 11.3.1was also installed.
Fig .1.
- Your environment now has the necessary packages to run
PyTorch-1_x-MNIST.ipynb. To run it, refer to: How to run a Jupyter notebook file.