You are not logged in.
Pages: 1
Hi, extra newbie question today. I'm simply trying to install PyTorch in a virtual environment, which is managed by virtualenv/virtualenvwrapper. Pretty fresh arch linux machine.
I've installed this package:
https://archlinux.org/packages/communit … n-pytorch/
I hoped that this would provide PyTorch, but no luck. I've created a new virtual environment, which pip and which python are correctly pointing to the environment's pip and python binaries, but pip install torch returns
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
I assumed that the arch package above would provide pytorch to my pip installation but maybe I'm missing something.
PS: Really I'm after torch v1.9.0, which is now legacy, so any help on which package is required for that or if that's a lost cause would be great.
Thanks
Last edited by TheMacDads (2021-12-27 19:34:32)
Offline
Look at pacman -Ss pytorch
Offline
You installed the repo package, so you can just use it by "import"ing the relevant bit in your python code.
In contrast, if you want to install it via pip (with the --user flag) then the repo package is irrelevant, pip downloads and installs from PyPi, in which case you need to use the PyPi package name not the arch linux repo package name. According to the upstream instructions this would be:
pip3 install torch torchvision torchaudio
Of course you don't need the "3" on pip, and you would need the "--user" flag, but the package names are there - there is no "pytorch", just "torch" and the others listed. You can also generally include the version you want, e.g., "torch=1.9.0".
See here for package names and available versions for pip installs: https://pytorch.org/
Last edited by Trilby (2021-12-17 20:11:38)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
PS: Really I'm after torch v1.9.0, which is now legacy, so any help on which package is required for that or if that's a lost cause would be great.
You can get older package versions from the Arch archive, 1.9.0 is there: https://archive.archlinux.org/packages/ … n-pytorch/
Just remember to add it to your "IgnorePkg" line in /etc/pacman.conf, as otherwise pacman will want to upgrade it immediately.
Last edited by Morn (2021-12-17 21:22:11)
Offline
Thank you for your responses. In this case, the issue was actually that pytorch is not available for the latest release of Python (3.10). I used pyenv to install Python 3.9.9, created a new virtualenv using that executable, and was then able to pip install the desired pytorch version
Offline
You sure? I just updated today.
pacman -Ss torch
community/python-pytorch 1.10.0-7
Tensors and Dynamic neural networks in Python with strong GPU acceleration (with
AVX2 CPU optimizations)
community/python-pytorch-cuda 1.10.0-7
Tensors and Dynamic neural networks in Python with strong GPU acceleration (with
CUDA and AVX2 CPU optimizations)
python --version
Python 3.10.1
Offline
I was attempting to install from pip, so from the Pypi repository. I think they may not host this version yet.
I would only like this to be installed in a virtual environment, not system-wide, so I don't think the arch repository's version is suitable for my needs but may be wrong about how this works
Offline
Hi, I am facing the same issue. Python3.10 is not supported for pytorch. The installation in arch linux will go smooth. However, python3.10 is not suitable for pytorch. One such instance is
https://discuss.pytorch.org/t/dataloade … s/139472/5
Is there an option to tell pacman to use specific python version. If so, please tell me how to do it.
Offline
I don’t think telling pacman about your python version is a good idea. I recommend using a virtual environment, which is good practice anyway with python. See virtualenvwrapper, which is a nice interface to virtualenv. You can make a new virtual environment using a specific python version. I recommend using pyenv to automate installing a legacy python3.9 version from source (I used 3.9.9). Then make a virtual environment which uses that binary (mkvirtualenv -p /path/to/binary) and then try to pip install torch. These steps worked for me last week
Offline
Or if you prefer to not use a virtual environment I think teckk’s original answer may be more useful for you
Offline
Hi, Thank you for the immediate reply. I have tried what you suggested but didn't work out. My kernel version is `5.15.12-arch1-1'. When i try to install nvidia and cuda using pacman, the versions are nvidia 495.46 and Cuda version 11.5. If you notice, pytorch supports until CUDA 11.3. I have done enough googling to downgrade the cuda version from 11.5 to 11.3 and tried to install the downgraded versions, however every time you downgrade it, there are some incompatible issues and my screen becomes black.
After quite some time in googling and when i ran out of options, i settled on pacman's packages for nvidia, and cuda rather than installing manually. Now upon settling on pacman's package and if i use virtualenv and try to install pytorch using pip, torch says
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
The above error are due to incompatible drivers of cuda and nvidia. Is there any solution that you can suggest? please help me. I am completely stuck.
Offline
I am still not clear. Pytorch community clearly stated that currenlty it doesn't support Python 3.10.
Link https://discuss.pytorch.org/t/dataloade … ols/139472
Then why is this package available for python3.10 ?
Offline
I recall setting up cuda-enabled pytorch to be quite tough in itself to be honest. I believe I used this series of packages from the AUR, but this is probably what you have tried already:
https://archlinux.org/packages/communit … orch-cuda/
I can say that the error messages that you have shown are the same as the ones I was receiving when I was using my Python 3.10 environment, so if you are still using Python 3.10 and pip I would recommend using a 3.9 version at least. If none of this is helpful you probably want to start a new thread which is more focused on Cuda and installing legacy Cuda for pytorch. I'm afraid it's not something I am familiar with
Best of luck!
Offline
Pages: 1