pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.01k stars 303 forks source link

Python installation on Rosetta systems #1121

Open hynek opened 10 months ago

hynek commented 10 months ago

This is more a FYI, since I don't need the feature, but I know you're on Windows so I thought you'd appreciate this data point: Currently Hatch's support for Python installations is useless for ARM Mac users that need to develop certain applications under Rosetta/Intel emulation.

The best way currently is using the official python.org installers, because they are universal and install a python3.12-intel64 binary that I then can use to create virtualenvs.

As far as I see, Hatch doesn't prefix its installation directories in any way (e.g. /Users/hynek/Library/Application Support/hatch/pythons/3.12/python/bin) so I wouldn't even be able to do the obvious and install one Hatch for ARM and one for Intel (as I do with PDM).

Unless I'm missing something, making the paths arch-conscious (e.g. ~/Application Support/hatch/pythons/arm64/3.12/python/bin) would solve that problem.

ofek commented 10 months ago

Interesting! I suppose you could install under specific locations manually. Is there some command that triggers emulation of another command for arbitrary arguments? Like on Linux you can do linux32 <command> [args...]

hynek commented 10 months ago

There's arch -x86_64 <command> and arch -arm64 <command>. But I faintly remember some weirdness like not being able to switch from an Intel shell to ARM or something. FWIW, I've written about some of my approach here: https://hynek.me/til/automatic-rosetta-fish-direnv/