astral-sh / rye

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

Default install instructions for Rye installs x86 version, not ARM (on my M1 mac). #1253

Closed alxmrs closed 3 months ago

alxmrs commented 3 months ago

Steps to Reproduce

On an ARM machine (I'm using an M1 Macbook Air):

  1. uninstall rye (if installed)
  2. install rye with the curl cmd: curl -sSf https://rye.astral.sh/get | bash
  3. Check if rye is x86 or ARM: file $(which rye)

Expected Result

Mach-O 64-bit executable arm64

Actual Result

Mach-O 64-bit executable x86_64

Version Info

I fixed this by manually installing the ARM version of rye before filing this issue. After the fix, this is what I have:

rye --version
rye 0.37.0
commit: 0.37.0 (09b67c469 2024-07-20)
platform: macos (aarch64)
self-python: cpython@3.12.4
symlink support: true
uv enabled: true

Stacktrace

No response

charliermarsh commented 3 months ago

What does uname -m return on your machine? That's what we use to determine the arch.

alxmrs commented 3 months ago

This is what I get:


% uname -m

arm64

On Sun, Jul 21, 2024 at 12:01 AM Charlie Marsh @.***> wrote:

What does uname -m return on your machine? That's what we use to determine the arch.

— Reply to this email directly, view it on GitHub https://github.com/astral-sh/rye/issues/1253#issuecomment-2241306766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARXAB2YUHUGEDE2I4HIEADZNLM4HAVCNFSM6AAAAABLGGIQQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGMYDMNZWGY . You are receiving this because you authored the thread.Message ID: @.***>

charliermarsh commented 3 months ago

Interesting, I wonder if your curl runs through Rosetta or something...? The script is fairly straightforward so not clear to me how it could be going wrong:

...

REPO=astral-sh/rye
PLATFORM=`uname -s`
ARCH=`uname -m`

if [[ $PLATFORM == "Darwin" ]]; then
  PLATFORM="macos"
elif [[ $PLATFORM == "Linux" ]]; then
  PLATFORM="linux"
fi

if [[ $ARCH == armv8* ]] || [[ $ARCH == arm64* ]] || [[ $ARCH == aarch64* ]]; then
  ARCH="aarch64"
elif [[ $ARCH == i686* ]]; then
  ARCH="x86"
fi

BINARY="rye-${ARCH}-${PLATFORM}"

...
alxmrs commented 3 months ago

Interesting, indeed! That's a good hunch, my curl is set up for both platforms? I'm not sure why it went for x86 when installing rye:


file $(which curl)

/usr/bin/curl: Mach-O universal binary with 2 architectures: [x86_64:Mach-O
64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]

/usr/bin/curl (for architecture x86_64): Mach-O 64-bit executable x86_64

/usr/bin/curl (for architecture arm64e): Mach-O 64-bit executable arm64e

On Sun, Jul 21, 2024 at 1:56 PM Charlie Marsh @.***> wrote:

Interesting, I wonder if your curl runs through Rosetta or something...? The script is fairly straightforward so not clear to me how it could be going wrong:

...

REPO=astral-sh/rye PLATFORM=uname -s ARCH=uname -m

if [[ $PLATFORM == "Darwin" ]]; then PLATFORM="macos" elif [[ $PLATFORM == "Linux" ]]; then PLATFORM="linux" fi

if [[ $ARCH == armv8 ]] || [[ $ARCH == arm64 ]] || [[ $ARCH == aarch64 ]]; then ARCH="aarch64" elif [[ $ARCH == i686 ]]; then ARCH="x86" fi

BINARY="rye-${ARCH}-${PLATFORM}"

...

— Reply to this email directly, view it on GitHub https://github.com/astral-sh/rye/issues/1253#issuecomment-2241582813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARXAB335FANEZVUTE6RKH3ZNOOW5AVCNFSM6AAAAABLGGIQQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGU4DEOBRGM . You are receiving this because you authored the thread.Message ID: @.***>

mitsuhiko commented 3 months ago

curl should not matter but what is bash on your machine? file $(which bash)?

alxmrs commented 3 months ago

Looks like that was the culprit! Good hunch.

file $(which bash)
/usr/local/bin/bash: Mach-O 64-bit executable x86_64
alxmrs commented 3 months ago

I'm happy to mark this as closed; seems like a rare/not so preventable error.

charliermarsh commented 3 months ago

Thanks for the follow-up.

HansBambel commented 2 months ago

Which Python architecture gets installed when this is getting returned? 😅

file $(which bash)
/bin/bash: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/bin/bash (for architecture x86_64):    Mach-O 64-bit executable x86_64
/bin/bash (for architecture arm64e):    Mach-O 64-bit executable arm64e
alxmrs commented 2 months ago

I posted this here, it was different than I expected.

https://github.com/astral-sh/rye/issues/1253#issuecomment-2243648984