The following is a code snippet that installs torch along with a full cuda environment that takes precedence over the host's.
The only problem is that $TORCH_VERSION
must be compatible with/compiled against $CUDA_VERSION
, and the latter should be available in conda's nvidia channel (older CUDA versions are not available).
ENV_NAME=segformer CUDA_VERSION=11.1 TORCH_VERSION=1.9 cli=mamba
$cli deactivate
$cli env remove -n $ENV_NAME
$cli create -n $ENV_NAME -c conda-forge -c nvidia python=3.10 gcc=11 gxx cuda-runtime=$CUDA_VERSION cuda-nvcc=$CUDA_VERSION cudatoolkit=$CUDA_VERSION cuda-libraries=$CUDA_VERSION cuda-libraries-dev=$CUDA_VERSION cuda-cudart=$CUDA_VERSION cudnn && \