When I try to install Torch whl, I get a 403 error...
# general
b
When I try to install Torch whl, I get a 403 error. The sha256 specified in the BUILD file is also recognized in the comments of the lock file, but the Pants tries to open one without sha256. I think we can’t download torch because if we don’t specify sha256 we get a 403 error. Error
Copy code
1. torch 2.1+cpu from <https://download.pytorch.org/whl/cpu/torch-2.1.0+cpu-cp311-cp311-linux_x86_64.whl>
    ERROR: Could not install requirement torch==2.1.0+cpu from <https://download.pytorch.org/whl/cpu/torch-2.1.0+cpu-cp311-cp311-linux_x86_64.whl> because of HTTP error 403 Client Error: Forbidden for url: <https://download.pytorch.org/whl/cpu/torch-2.1.0+cpu-cp311-cp311-linux_x86_64.whl> for URL <https://download.pytorch.org/whl/cpu/torch-2.1.0+cpu-cp311-cp311-linux_x86_64.whl>
BUILD
Copy code
python_requirement(
    name="torch-cpu-package",
    requirements=[
        "torch@ <https://download.pytorch.org/whl/cpu/torch-2.1.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5954924ce74bc7e6a6c811e3fa4bdda9936d9889f6369fd068420c444bfd1cae>",
    ],
)
default.lock
Copy code
...
//     "torch@ <https://download.pytorch.org/whl/cpu/torch-2.1.0%2Bcpu-cp311-cp311-linux_x86_64.whl#sha256=5954924ce74bc7e6a6c811e3fa4bdda9936d9889f6369fd068420c444bfd1cae>",
...


"locked_resolves": [
...      
          "artifacts": [
            {
              "algorithm": "sha256",
              "hash": "5954924ce74bc7e6a6c811e3fa4bdda9936d9889f6369fd068420c444bfd1cae",
              "url": "<https://download.pytorch.org/whl/cpu/torch-2.1.0+cpu-cp311-cp311-linux_x86_64.whl>"
            }
          ],
...
Do you have any idea? thank you
g
Are you using
find_links
? If so, it sounds like the same issue as here: https://github.com/pantsbuild/pants/issues/20474
b
https://pantsbuild.slack.com/archives/C18RRR4JK/p1707186258447289 was released just today with the fix, so manually updating pex should hopefully resolve it (I’m on mobile so can’t easily link, but it’s the
[pex-cli]
subsystem that’s of interest)
p
Thanks for bringing this up, we were affected by this issue today :)
Copy code
[pex-cli]
known_versions = [
  "v2.1.162|macos_arm64|95babb1aa147e2803b7744ba0c025aede8e5fc00322ed535675a51563672486b|3676166",
  "v2.1.162|macos_x86_64|95babb1aa147e2803b7744ba0c025aede8e5fc00322ed535675a51563672486b|3676166",
  "v2.1.162|linux_x86_64|95babb1aa147e2803b7744ba0c025aede8e5fc00322ed535675a51563672486b|3676166",
  "v2.1.162|linux_arm64|95babb1aa147e2803b7744ba0c025aede8e5fc00322ed535675a51563672486b|3676166"
]

version="v2.1.162"
this is the entry I've used in
pants.toml
for anyone interested
1
g
One of those entries is broken fyi, the last sha has a trailing 5.
1
🙏 1
b
Thank you all, I have tried to upgrade the version of pex-cli, but I get the same error. I will look into this a little more in my environment.
Are you using
find_links
? If so, it sounds like the same issue as here:
I don’t use
find_links
.
g
:👍 Did you relock as well after upgrading pex-cli? I cannot reproduce the issue with latest
pex
CLI.
w
Hi, that's great! How do I make pants use this version?
b
I was bad, I forgot to relock after updating pex-cli. relocking got it installed.
Thank you!
g
😅 Happy that it works. @wonderful-boots-93625, you can take the snippet above by @powerful-eye-58407 and add to your
pants.toml
, then relock. That should hopefully resolve the issue.
1
c
I was lucky to open this channel on this specific message, since I faced literally the same issue, the snippet above did fix the issue for me as well. Thank you!! 🙏
👍 3