1

I've tried multiple things e.g.

conda install -y pytorch==1.9 torchvision torchaudio torchtext cudatoolkit=11.0 -c pytorch -c nvidia

but it never ends up downloading the version with cuda 11.0 or above for some reason.

The error message is too large to paste but you can see details here: https://github.com/pytorch/text/issues/1395

It should be easy to reproduce with an empty env as follow:

conda create -n env_a40 python=3.9
conda activate env_a40
conda install -y pytorch==1.9 torchvision torchaudio torchtext cudatoolkit=11.0 -c pytorch -c nvidia

crossposted:

related:


note you can also try it with pip:

pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

with no success yet.

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
  • I don't expect cuda to be installed by those commands. I load cuda in my hpc with `module load cuda-toolkit/11.1` which I think means they have installed it for me already. To be honest I don't know what is going wrong with my attempts. – Charlie Parker Sep 17 '21 at 23:45
  • I've done something like that before `conda install -y pytorch==1.9 torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia`, but when I go ahead and download `torchtext` I get issues. – Charlie Parker Sep 20 '21 at 16:01
  • `pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html; pip3 install torchtext==0.10.1` seems to work for me – Charlie Parker Sep 23 '21 at 17:26

2 Answers2

9

According to the documentation page PyTorch's compiled version 1.9 is only available for platform CUDA 10.2 and CUDA 11.1.

It seems you are indeed using CUDA 11.1 (from your comment on running module load cuda-toolkit/11.1 on your environment). You should therefore install PyTorch version 1.9.0-py3.9_cuda11.1_cudnn8.0.5_0 instead, i.e. using the command:

conda install -y pytorch==1.9 torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia

If you are using pip do:

pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
pip3 install torchtext==0.10.1

probably can be compressed to:

pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 torchtext==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html

but have not tried it.

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
Ivan
  • 34,531
  • 8
  • 55
  • 100
  • I've done something like that before `conda install -y pytorch==1.9 torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia`, but when I go ahead and download `torchtext` I get issues. – Charlie Parker Sep 20 '21 at 16:01
  • Could you show the traceback error? – Ivan Sep 20 '21 at 16:21
  • surprisingly there is no error reported. It says it's already installed: ` Collecting package metadata (current_repodata.json): done Solving environment: done # All requested packages already installed.` but when I go ahead and grep the conda list for the pytorch versions it says they are cpu only: – Charlie Parker Sep 20 '21 at 17:19
  • `(metalearning_gpu) miranda9~/automl-meta-learning $ conda list | grep torch cpuonly 1.0 0 pytorch ffmpeg 4.3 hf484d3e_0 pytorch pytorch 1.9.0 py3.9_cpu_0 [cpuonly] pytorch torch 1.9.0+cpu pypi_0 pypi torchaudio 0.9.0 pypi_0 pypi torchmeta 1.7.0 pypi_0 pypi torchvision 0.10.0+cpu pypi_0 pypi` – Charlie Parker Sep 20 '21 at 17:19
  • Are you sure you did that on a clean conda env? – Ivan Sep 20 '21 at 17:54
  • apologies if this is a dumb response, but it was not clean because I tried installing pytorch on it. Perhaps what you meant is if I did a new attempt on a new env. That I did not but I am happy to try it! – Charlie Parker Sep 20 '21 at 18:18
  • Yes indeed, it worked on my end at least. – Ivan Sep 20 '21 at 21:20
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/237333/discussion-between-charlie-parker-and-ivan). – Charlie Parker Sep 21 '21 at 17:21
  • Did you manage to get it working? – Ivan Sep 23 '21 at 08:55
  • 1
    I am trying right now. Apologies, the HPC I use takes so much time to do installs then when I come back it takes effort to remember what was my attempt and in the way I make mistakes etc. I am trying again right now, hopefully it works, will report and share what I tried in detail (perhaps as an answer). Thanks for the patience and support! :) – Charlie Parker Sep 23 '21 at 14:39
  • 1
    Ok it seems to be working. Somehow in my hpc conda doesn't behave nicely so I did everything with pip. In particular it seems I need torch.text version `0.10.1`. Thanks! I will add an answer with prints of my console. – Charlie Parker Sep 23 '21 at 17:19
  • I believe if you just put `torchtext` (w/ o specifying any version) it will fetch the compatible version for you – Ivan Sep 23 '21 at 18:08
0

For me it worked with torchtext 0.10.1. The order of how I did things is install pytorch first with:

pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

(probably use the most recent command from the pytorch website https://pytorch.org/get-started/locally/, but if that doesn't work then go to the torchtext website to see what versions of python and pytorch they support and install that. Hopefully in the future torchtext will be in line with the main pytorch branch https://github.com/pytorch/text)

Then since I was using my personal library I installe it in editable mode:

pip install -e ~/ultimate-utils/ultimate-utils-proj-src

or from pypi

pip install ultimate-utils

then go to python to test the pytorch version:

(uutils_env) miranda9~/type-parametric-synthesis $ python
Python 3.9.7 (default, Sep 16 2021, 13:09:58) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchtext

>>> 
>>> from torchtext.vocab import Vocab
>>> 

it knows to install the right version due to my setup.py file. But you can install the right version as follows:

pip install torchtext==0.10.1

In the future the above versions might change and you might have to open an issue in torchtext's github.

Note:

If you are using pip do:

pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
pip3 install torchtext==0.10.1

probably can be compressed to:

pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 torchtext==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html

but have not tried it.

Acks: In particular thanks @ivan for the help!

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323