Updating PyTorch

How about /home/atcold/anaconda3/lib/python3.5/site-packages/torchvision/__init__.py? If that doesn’t exist you can use find (terminal command) to look for a torchvision directory under /home/atcold/anaconda3/lib/python3.5/site-packages. It has be somewhere there.

Oh, maybe I’ve figured it out…

atcold@GPU0 ~/anaconda3/lib/python3.5/site-packages $ ls -daF torch*
torch/  torch-0.1-py3.5.egg-info/  torchvision-0.1.6-py3.5.egg  torchvision.pth

There is no directory. Just a pth and an egg.

Oh yeah, I think it’s zipped in an egg.

1 Like

this is no longer working.

PackageNotFoundError: Package not found: ‘pytorch’

1 Like

Hi,

is this still relevant? I added soumith to my conda channels but pytorch 0.3 (released a few days ago) still does not show up when I run conda update pytorch torchvision

FYI. In order to install the latest torch and torchvision, now, you do

conda install pytorch torchvision -c pytorch

You can also read this post ( Pytorch 0.3 version is released).

6 Likes

For me this did not work. It always tried to downgrade my pytorch and torchvision to some rather ancient version.

I installed it again in a separate environment using pip then which worked.

What about uninstall original torch and torchvision and install again?

Tried that aswell. So far only Pip seems to work for me.

This worked for me!

conda update pytorch torchvision -c pytorch

The following NEW packages will be INSTALLED:

cudatoolkit: 8.0-3

The following packages will be UPDATED:

pytorch:     0.2.0-py36h53baedd_4cu80 soumith [cuda80] --> 0.3.0-py36_cuda8.0.61_cudnn7.0.3h37a80b5_4 pytorch
torchvision: 0.1.9-py36h7584368_1     soumith --> 0.2.0-py36h17b6947_1                       pytorch
5 Likes

If the dependencies are not met, conda will not update to recent pytorch. What I did was the following.

  1. conda install pytorch=0.3.0 -c pytorch ( This gave the missing dependencies)
  2. Install the missing dependencies from Anaconda Cloud ( in my case they where numba, blaze )
  3. conda update pytorch torchvision -c pytorch
4 Likes

I can no longer edit the original post. Now you need to use this command instead (basically, you need to replace soumith with pytorch).

conda config --add channels pytorch

Yeah, the soumith channel is now called pytorch. See post above.

1 Like

Just a general note, it’s probably better to do the torch.__file__ checks with via isfile and abspath:

>>> import torch
>>> import os
>>> os.path.isfile(torch.__file__)
True
>>> os.path.abspath(torch.__file__)
'/Users/sebastian/miniconda3/lib/python3.6/site-packages/torch/__init__.py'

Hey guys. What is the recommended way of upgrading to PyTorch V1.0 using conda? After adding the pytorch channel and trying to update this message appears:

# All requested packages already installed.

Any suggestions?

I would recommend to create a new conda environment and install there your 1.0 preview.
In that way you can just delete it once the 1.0 stable version will be released and your other code is still executable.
Have a look here to learn how to manage environments.

1 Like

Thanks for your reply. How does one go about installing the 1.0 preview? After installing the nightly version from source I end up with version 0.4.1

How did you install the nightly version?
You can find the install commands on the PyTorch website.

E.g. for the 1.0 preview on Ubuntu with CUDA9.0 you would need to install it using:

conda install pytorch-nightly -c pytorch

If that doesn’t work, try to update conda and run it again.

Hey, I resolved this. It was a conflict between an older preinstalled version which was 0.4.1. I removed it and reinstalled the nigthly version of pytorch and it works smoothly now. Thank you for your help.

Edit:
When running: python -c “import torch; print(torch.version)” I get the 1.0 version but when importing in jupyter notebook the 0.4.1 version appears again.

Edit2: Resolved, the new conda env was missing an ipython kernel so jupyter was loading PyTorch from another env that had one

see: Updating PyTorch -- Is there an "Official" Way? - #10 by Brando_Miranda