astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.82k stars 467 forks source link

Rye installation on WSL2 Ubuntu fails. Script shows error because uv cannot be downloaded #1220

Closed mc51 closed 4 months ago

mc51 commented 4 months ago

Steps to Reproduce

Trying to install rye on Linux with the suggest method:

curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash

Expected Result

Rye should be installed fully and without errors. It should work after installation.

Actual Result

I'm getting this error during install:

Bootstrapping rye internals
error: download of https://github.com/astral-sh/uv/releases/download/0.2.22/uv-x86_64-unknown-linux-gnu.tar.gz failed

Caused by:
    [6] Couldn't resolve host name (Could not resolve host: github.com)

The rye command itself is available after install but it's not usable. When running e.g. rye add requests, I'm getting the same problem:

$ rye add requests
Bootstrapping rye internals
error: error bootstrapping venv

Caused by:
    0: download of https://github.com/astral-sh/uv/releases/download/0.2.22/uv-x86_64-unknown-linux-gnu.tar.gz failed
    1: [6] Couldn't resolve host name (Could not resolve host: objects.githubusercontent.com)

My guess is, this is because https://github.com/astral-sh/uv/releases/download/0.2.22/uv-x86_64-unknown-linux-gnu.tar.gz is receiving a 302 response with the actual file location. For example, curl doesn't seem to handle that correctly. If I do curl -O https://github.com/astral-sh/uv/releases/download/0.2.22/uv-x86_64-unknown-linux-gnu.tar.gz the created file is empty. However, if we instruct curl to follow the redirect, it works: curl -L -O https://github.com/astral-sh/uv/releases/download/0.2.22/uv-x86_64-unknown-linux-gnu.tar.gz. I suspect the same behavior during installation. I'll try to take a look at the code to confirm, after posting this.

/e: This doesn't seem to be the case. As far as I can tell, the used curl library should be following the redirect as specified here.

Version Info

This is with the current installer script, trying to install rye 3.6.0 (but same with all other version to be installed). I'm on Ubuntu running in WSL2 under Windows 10:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

My curl is:

$ curl --version
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

Stacktrace

No response

PadenZach commented 4 months ago

This may be a duplicate of #1212, are you behind any sort of corporate firewall?

mc51 commented 4 months ago

Yes, I think this is a duplicate as it sounds like the same issue. It happens in a corporate firewall environment and there is obviously some mitm going on. But the error message is strange and also the fact that downloading the file via curl is no problem. I'm closing this and trying to contribute to the solution in the other issue.