asdf-community / asdf-python

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

Python 3.10.15 fails to build from source because it uses incompatible openssl@1.1 from homebrew #192

Open gravieure opened 1 month ago

gravieure commented 1 month ago

Provide environment information

OS: Darwin GR0426 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64 arm Darwin

SHELL: GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin22.1.0) Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

BASH VERSION: 5.2.15(1)-release

ASDF VERSION: v0.14.1

ASDF INTERNAL VARIABLES: ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions ASDF_DATA_DIR=/Users/ian.eure/.asdf ASDF_DIR=/opt/homebrew/Cellar/asdf/0.14.1/libexec ASDF_CONFIG_FILE=/Users/ian.eure/.asdfrc

ASDF INSTALLED PLUGINS: awscli https://github.com/MetricMike/asdf-awscli.git main c26bbb4 direnv https://github.com/asdf-community/asdf-direnv.git master 6ff3dbe grails https://github.com/weibemoura/asdf-grails.git master ba222b0 groovy https://github.com/weibemoura/asdf-groovy.git master e33491d java https://github.com/halcyon/asdf-java.git master 9b35c84 leiningen https://github.com/miorimmax/asdf-lein.git master dfd8ab1 mysql https://github.com/iroddis/asdf-mysql.git master 8031228 nodejs https://github.com/asdf-vm/asdf-nodejs.git master c36e6f0 python https://github.com/danhper/asdf-python.git master a3a0185

To Reproduce

  1. Install Homebrew.
  2. Run brew install asdf openssl@1.1 readline tcl-tk ncurses.
  3. Run asdf plugin add python.
  4. Run asdf install python latest:3.10.15.

Describe the Bug

Python fails to build:

python-build 3.10.15 /Users/ian.eure/.asdf/installs/python/3.10.15
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.15.tar.xz...
-> https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz
Installing Python-3.10.15...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use ncurses from homebrew
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/ian.eure/.asdf/installs/python/3.10.15/lib/python3.10/ssl.py", line 99, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
ERROR: ". Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

BUILD FAILED (OS X 14.5 using python-build 2.4.16)

Inspect or clean up the working tree at /var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/python-build.20241017141705.7605
Results logged to /var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/python-build.20241017141705.7605.log

Last 10 log lines:
        DYLD_LIBRARY_PATH=/var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/python-build.20241017141705.7605/Python-3.10.15 ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi
Looking in links: /var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/tmp5pgrv_jk
Processing /private/var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/tmp5pgrv_jk/setuptools-65.5.0-py3-none-any.whl
Processing /private/var/folders/s_/7bxk_vw57xq9qgdsl0zj747m0000gp/T/tmp5pgrv_jk/pip-23.0.1-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.10 are installed in '/Users/ian.eure/.asdf/installs/python/3.10.15/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.0.1 setuptools-65.5.0

Here's the brew info for openssl@1.1:

==> openssl@1.1: stable 1.1.1w (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
Deprecated! It will be disabled on 2024-10-24.
Installed
/opt/homebrew/Cellar/openssl@1.1/1.1.1w (8,101 files, 18MB)
  Poured from bottle using the formulae.brew.sh API on 2024-01-05 at 11:10:00
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/openssl@1.1.rb
License: OpenSSL
==> Dependencies
Required: ca-certificates ✔
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /opt/homebrew/etc/openssl@1.1/certs

and run
  /opt/homebrew/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> /Users/ian.eure/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
==> Analytics
install: 22,694 (30 days), 73,014 (90 days), 473,032 (365 days)
install-on-request: 14,220 (30 days), 45,278 (90 days), 259,740 (365 days)
build-error: 9 (30 days)

Expected Behaviour

Python should compile.

gravieure commented 1 month ago

Okay, my immediate issue was resolved by uninstalling openssl@1.1 from Homebrew; Python 3.10.x requires newer OpenSSL than that. Unfortunately, several other tools I need depend on openssl@1.1, so those are broken for the time being.

Is is possible for asdf/this plugin to build Python with an openssl@3 package, rather than selecting an older version that doesn't work?