Install conda and set up a Pytorch 1.7, CUDA 11.1 environment on Ubuntu/Windows

In this fast post, you will know how to set up an environment using conda (Anaconda) and PyTorch last stable version (1.7.1) with an Nvidia Driver 11.1; first of all, you can check how to successfully install CUDA for ubuntu here, at the first half of that post you can learn how to install any driver-version for your GPU.

My 2 NVIDIA Quadro RTX 6000

Installing Conda

First, you need to install Anaconda on your computer. To do this, you can check the installing guide from the website in any OS here.

Setting up a Conda environment

Then, set up a conda environment ready to use PyTorch, once you installed conda, just type:

conda create --name pytorch python=3.7
conda activate pytorch
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
conda install -c conda-forge tensorboardx -y
conda install -c conda-forge notebook -y
conda install -c conda-forge numpy=1.16.6 -y
conda install -c conda-forge pandas -y
conda install -c conda-forge matplotlib -y
conda install -c conda-forge opencv -y
conda install -c conda-forge scikit-learn -y
conda install -c conda-forge tqdm -y
conda install -c conda-forge scikit-image -y
conda install -c anaconda scipy=1.5.3 -y
conda install -c anaconda h5py=2.10.0 -y
# Some specific package
conda install -c anaconda pywget -y
conda install -c conda-forge shapely

After all this process, you are free to check your python version inside your conda environment and check if Cuda is available as well.

Checking my torch version and GPU available

So, now you can start creating your model and developing some projects :)
I hope you enjoyed reading this post, if you liked and founded it helpful share it pls.

Final notes: You can do the same on your Windows just getting the installer from here.

Computer Scientist at(@UNIoficial) and Cat lover ❤. Visit