Here we are going to install PyTorch via conda (if you don't have Miniconda installed in your Linux or WSL, click here).
Warnings:
- If you intent to write a neural network from scratch, go for the latest stable version.
- If you intent to test an existing PyTorch code, pay attention to the required version. Previous releases are compatible with a set of others libraries like "torchvision", as listed here. Also, choose the correct version for Python the code needs, and search in here a file like:
- pytorch-1.9.1-py3.9_cuda10.2_cudnn8.0.5_0.tar.bz2
- Note: if you can't find it in there, then there is no way to install it. Try to do it via pip.
First of all, we create an environment named "PyTorchEnv", or the name you want, and activate it:
- conda create -n PyTorchEnv python=3.7
- conda activate PyTorchEnv
Then, we install PyTorch making explicit the versions you want:
- conda install -c pytorch pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1
Now, test if the packages are installed:
- python3 -c "import torch; print(torch.cuda.is_available(), torch.cuda.current_device(), torch.cuda.device_count(), torch.cuda.get_device_name(0))"
- True 0 1 NVIDIA GeForce RTX 2060 SUPER
No comments:
Post a Comment