Update PyTorch version on LINUX w/ CUDA

I want to make sure that I do not break my installation on my LINUX machine with GPU (cuda 8.0) when attempting to update pytorch, so I am asking here to be sure.

The context is that I had installed PyTorch on my LINUX machine a per the old instructions. Specifically, I have a virtualenv environment, and within that, I pip installed from a wheel.

I would like to now upgrade my PyTorch version to whatever is on master, and the website has this to say about LINUX with CUDA8:

conda install pytorch torchvision cuda80 -c soumith

However, I do not have conda, and anyway I installed via a wheel with pip.

Is there anything I should do (or not do) in particular here to make sure I do not break my system? I want to basically just update my pytorch on my LINUX machine.

Thanks!

git clone https://github.com/pytorch/pytorch
cd pytorch
python setup.py install

then later
cd pytorch
git pull origin master
python setup.py install

2 Likes

Thanks!

I am a little confused though - since I operate out of my pip virtual env… how does python “know” which version of pytorch to use?.., when I do import torch for example?

@Veril I am not also confused… how do I know what version of pytorch is currently being run? The pip one (old one) is showing here, but … how do I load the new version once it’s installed? And how do I know what version I have imported? And lastly, how can I control which version I want to load?? thanks!!

Hope there is something like “luarocks install nn” in Torch7 so that we can update blood-edge versions quicky…

There’s a list of directories where Python will look for packages - sys.modules. If it’s found in any of them, it will stop looking further and load that. When you run in virtualenv, sys.modules is extended by putting the local package directory before the system-wide one.

Next version of PyTorch is going to have torch.version attribute, so you’ll be able to check which one has been loaded. You can use pip uninstall torch to get rid of the old install.

All remaining question are about managing venvs, and there are probably lots of articles, that will explain it better, that I will in this short response.

1 Like

@apaszke Im in a real rut here.

I would like to right now un-install the NEW pytorch that I installed via @Veril’s answer, and go back to the old 1.6 version, (that I still have here on pip).

How do I do that? I looked at sys.modules but… it’s just a huge amount of information dumped into the screen. I currently do not know how to control what version is being loaded… :-/ Help!

It’s really hard for me to debug this remotely. Just run pip uninstall torch until it tells you that there’s no such package installed. Then install the version you want.