Pytorch 1.5.0 + CUDA
I’m trying to find an “offically” recommended way to update PyTorch and associated libraries to the latest stable version (from another stable version), but almost all the results I come across are at least a few years old and mostly workarounds to specific problems, or relates to pip, both here and at StackOverflow, so I started a new thread.
What is the command to update only PyTorch and related libraries?
conda update --all take care of this, if I also wish to update Python and Jupyter, for example? (PyTorch has its own dedicated environment.)
I generally don’t bother with updating PyTorch, but just uninstall the old version and install the latest one.
I’m not even sure if an “update” would do something different.
Thanks for the reply. In the interim, I’d tried comparing the differences between
conda update pytorch torchvision cudatoolkit -c pytorch and
conda update --all. It turned out that the former updates everything except Python and Matplotlib. So, I ran both commands in that order, but now when I try to import PyTorch I get an error about VS Runtime.
(pytorch) PS C:\Users\Navneeth> python
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Navneeth\Miniconda3\envs\pytorch\lib\site-packages\torch\__init__.py", line 127, in <module>
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\Navneeth\Miniconda3\envs\pytorch\lib\site-packages\torch\lib\asmjit.dll" or one of its dependencies.
This is weird since conda automatically installs the runtime whenever an environment is created.
This is the relevant bit from the output of
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_3
If I can bring back to life this thread. I understand from here that there is no official way to update Pytorch. But any suggestion instead? In my case I installed Pytorch 1.7.1 when, at that time, I had CUDA 10.1. Now my system automatically has been updating and now I have CUDA 11.2 with no problems. I have only seen installation instructions until CUDA 11.1. Am i suppose to have any compatibility problems with this?
I don’t want to create a new conda environment if not necessary, since as I remember Pytorch installation took a long while and if there is any way to properly carry out the process it would be good to know…
Thanks in advace,
The PyTorch binaries ship with their own CUDA runtime (in the mentioned case with CUDA11.1) and your local CUDA toolkit will only be used if you build PyTorch from source or compile custom CUDA extensions. To run PyTorch on the GPU, you would need to have a compatible driver, which should be the case in your setup.
I’m not sure I understand this concern, since you would have to download the binaries in any case.
To update PyTorch and CUDA alone, I’ve stuck to
conda update pytorch torchvision cudatoolkit -c pytorch
since this thread. I update other libraries for Jupyter and visualisation, for example, thereafter.
Good to see
conda update is also working! Did you see any advantage over reinstalling it, i.e. were some packages only partially pulled?
An obvious advantage is fewer steps. Apart from that I think the whole process was uneventful (which is a good thing). It’s been a while since I bumped up a version; I’ll make sure to update this thread if something happens next time.