I’m trying to install PyTorch on Ubuntu 24 (running in the Windows Subsystem for Linux), under Python 3.12.3, but I can’t get it to work. I posted to thread 110436 “Pytorch for Python 3.12 not available”, and it was suggested I start “a new issue with more details on your environment, how you’re trying to install torch and the error you’re seeing.” (See also my thread at a Ubuntu forum, since I initially assumed it was a Ubuntu problem.) So here are the things I’ve tried, with the results:
apt install pytorch
: “Unable to locate package pytorch”apt install torch
: “Unable to locate package torch”apt install python-pytorch
: “Unable to locate package python-pytorch”apt install python-torch
: “Unable to locate package python-torch”- Variants of the above using pip3, like
pip3 install python-pytorch
: “error:
externally managed-environment… try apt install python3-xyz, where xyz is
the package you are trying to install.” - Downloaded
torch-2.6.0-cp312-cp312-manylinux1_x86_64.whl
and tried
to install it using
pip3:pip3 install --use-wheel --find-links-<path to downloaded whl file>
“error: externally managed-environment” again. - I was able to use
pipx
to install it from the above .whl
file, butpipx
is for
executables, not libraries, so the files wind up in the wrong place. Possibly
I could move them to the right place manually, but I have not tried that.
If pytorch has been released for Python 3.12, I guess the absence of the pytorch library files when I use apt
is an Ubuntu problem.
I used to install library files with pip3
, but this appears no longer to be possible, at least under Ubuntu. Am I doing something wrong with pip3 to cause the “externally managed-environment” error? I suppose the solution is to set up a separate Python virtual environment, but that seems a complication…