astral-sh / rye

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

cannot boostrap rye in devcontainer environment #1144

Closed sloppycoder closed 2 weeks ago

sloppycoder commented 3 weeks ago

Steps to Reproduce

  1. start a container with base devcontainer image
    docker run --rm -it -u vscode -w /home/vscode mcr.microsoft.com/devcontainers/rust:bookworm bash
  2. try to run rye install script inside the container
vscode ➜ ~ $ which curl gunzip
/usr/bin/curl
/usr/bin/gunzip

vscode ➜ ~ $ curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.34.0" RYE_INSTALL_OPTION="--yes" /bin/bash
This script will automatically download and install rye (0.34.0) for you.
######################################################################## 100.0%
Welcome to Rye!

This installer will install rye to /home/vscode/.rye
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.34.0
  Platform: linux (aarch64)

Installed binary to /home/vscode/.rye/shims/rye
Bootstrapping rye internals
error: download of https://github.com/astral-sh/uv/releases/download/0.1.44/uv-aarch64-unknown-linux-gnu.tar.gz failed

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

But manually run wget to download works fine.

vscode ➜ ~ $ wget https://github.com/astral-sh/uv/releases/download/0.1.44/uv-aarch64-unknown-linux-gnu.tar.gz
--2024-06-07 07:38:55--  https://github.com/astral-sh/uv/releases/download/0.1.44/uv-aarch64-unknown-linux-gnu.tar.gz
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/699532645/a3be59e0-ccfd-4e99-b3a2-add5956c5d6d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240607T073857Z&X-Amz-Expires=300&X-Amz-Signature=86dbd3ec8db64faac5d11c0b6e30cb75a69db3ae75454f9bb47c22d7981e3c35&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=699532645&response-content-disposition=attachment%3B%20filename%3Duv-aarch64-unknown-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream [following]
--2024-06-07 07:38:57--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/699532645/a3be59e0-ccfd-4e99-b3a2-add5956c5d6d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240607T073857Z&X-Amz-Expires=300&X-Amz-Signature=86dbd3ec8db64faac5d11c0b6e30cb75a69db3ae75454f9bb47c22d7981e3c35&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=699532645&response-content-disposition=attachment%3B%20filename%3Duv-aarch64-unknown-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12103785 (12M) [application/octet-stream]
Saving to: 'uv-aarch64-unknown-linux-gnu.tar.gz'

uv-aarch64-unknown-linux-gnu. 100%[=================================================>]  11.54M  10.9MB/s    in 1.1s

2024-06-07 07:39:05 (10.9 MB/s) - 'uv-aarch64-unknown-linux-gnu.tar.gz' saved [12103785/12103785]

Expected Result

the installer script should be able to bootstrap itself.

Actual Result

the script fails with [6] Couldn't resolve host name (Could not resolve host: github.com). Sometimes the host name is objects.githubusercontent.com. Manually download uv with wget always works, as show above.

Version Info

0.34.0. also tried 0.33.0, 0.32.0, same result. also tried bullseye version of the microsoft devcontainer image, same result

Stacktrace

No response

sloppycoder commented 3 weeks ago

I'm running this on a M1 Macbook Air with Rancher Desktop 1.13.1.

dennisrall commented 3 weeks ago

Seems like a networking issue for me, that maybe has nothing to do with rye?

I built a devcontainer with rye inside myself using the rye feature. Maybe that helps you. See https://containers.dev/features and search for rye. And add the follwing to your devcontainer json:

    "features": {
        "ghcr.io/schlich/devcontainer-features/rye:1": {
            "version": "1.2.2"
                }
    }
sloppycoder commented 3 weeks ago

I started with this feature, which gave me the same problem, which led me to the steps to reproduce.

sloppycoder commented 3 weeks ago

I launched fresh VMs with x64 and arm64 CPUs on Google Cloud, installed docker.io and then re-run the steps. both turned out to be ok!

Seems like it's a Rancher Desktop problem. I'll file a bug there, but I appreciate some insight how to debug and troubleshoot. And maybe the rye code can use a bit more retry to handle this sort of flaky network?

sloppycoder commented 2 weeks ago

i implemented a temporary workaround that adds host needed to /etc/hosts. I'll take it up with Rancher Desktop and LIMA app project on this.

closing since it's the issue is elsewhere.