asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
661 stars 56 forks source link

Readme tip to use environment variable to patch causes all Python installation for all versions to fail on MacOS Sonoma 14.0 #176

Open DiesDasJenes opened 12 months ago

DiesDasJenes commented 12 months ago

Provide environment information

I have a MacOs with Sonoma 14.0. I followed the README of the plugin and set the env var ASDF_PYTHON_PATCH_URL.

To Reproduce

On MacOs set the URL accordingly to the README. Then run asdf install python 3.9.0

Describe the Bug

I attempted to install a version of python. The installation would fail without any explanation.

Expected Behaviour

I expected a clean installation of python.

andrewcrook commented 11 months ago

A couple of things

Not all versions of python officially support Apple Silicon (Mx)

asdf-python uses pyenv which has a plugin called python-build its job is to apply patches and compile compatible versions. This is still limited because of other compatibly issues e.g compiler, sdks , library versions etc.

versions that should work out of the box, that is no ASDF_PYTHON_PATCH_URL set. work for me on Apple silicon with asdf-python are the following.

I haven't gone any further because anything under 3.8 doesn’t receive security updates and is consider to be in end of life. Anything under 3.10 don't get most bug fixes.

There are some unofficial patches out there to get specific versions to work, personally, I don't use them.

Also make sure you have all the dependences installed required to build and require by python. Homebrew, makes this easy for mac users and I believe even python-build has some builtin compatibility for homebrew.

I have just tried macOS Sonoma will all of the above and they work.

If you’re adamant on getting older versions to work then I suggest looking for unofficial back ports and unofficial patches. Another option is to use the Intel versions this can be achieved via Rosetta 2 although I see most people have troubles to get it to compile python. Other options are using Intel system emulation with a Linux VM such as Qemu and Docker Buildx which also uses Qemu. Other than that, I would forget using them unless you are forced.

If you have any issues with the above versions without ASDF_PYTHON_PATCH_URL set. Try looking at setting any verbose and/or tracing arguments if available, look at asdf info and brew doctorfor errors and brew listfor missing python dependences. If you get any errors provide them and also check your $TMPDIRpath for any logs regarding python-build etc and looking at the console app logs also wouldn’t hurt.