Skip to content

Unable to install any python versions with pyenv in MacOS 11-12: "checking for the platform triplet based on compiler characteristics... darwin", "internal configure error for the platform triplet" #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks
Jake-Mulhern opened this issue Nov 3, 2021 · 36 comments

Comments

@Jake-Mulhern
Copy link

Description

  • Platform information (e.g. Ubuntu Linux 16.04): Mac OS (Big Sur version 11.6)
  • pyenv version: 2.2.0
  • Python version: Currently Python=2.7 and Python3=3.9 (Attempting to install 3.6)

I installed pyenv using homebrew. Every step along the way looked correct, however when I run

pyenv install 3.6.6

I get the following error

python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.6.tar.xz...
-> https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz
Installing Python-3.6.6...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.6 using python-build 2.2.0-5-g54889eb8)

Inspect or clean up the working tree at /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211103152847.87140
Results logged to /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211103152847.87140.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... no
checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.
  
checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.

I have tried uninstalling and reinstalling and continue to receive this error. Please assist.

@native-api native-api changed the title Unable to install any python versions with pyenv Unable to install any python versions with pyenv in MacOS 11 Nov 3, 2021
@native-api
Copy link
Member

native-api commented Nov 3, 2021

For 3.6 specifically, duplicate of #1737 . 3.6 doesn't support MacOS 11+.

@native-api native-api marked this as a duplicate of #1737 Nov 3, 2021
@genewliu
Copy link

Hi sir - sorry I think we need some help on this issue as it seems different from #1737.

@youngtechc
Copy link

Did you ever get a response? I'm running into the same issue

@lofoyet
Copy link

lofoyet commented Mar 15, 2022

same here

@native-api
Copy link
Member

Need full diagnostic info as per the issue template and also config.log.

@native-api
Copy link
Member

Also please explain how the issue is different from #1737 . It says there clear as day that 3.6.6 is incompatible with MacOS 11+.

@MarcFogleman
Copy link

I have a coworker with this same error when trying to install 3.10.0. @Jake-Mulhern, does your Macbook have an M1 Pro chip?

@abhishekeb7
Copy link

Facing the same issue.

Platform: MacOS Monterey 12.3 with Intel chip.

@DanielFNG
Copy link

Accidentally posted this on a closed issue earlier (#1737 (comment)).

I have not seen this issue before upgrading to Monterey 12.3, but now I am unable to install Python 3.8.12 using pyenv. I am on an M1 Mac, and installed pyenv, and the python3 dependencies, via homebrew following the installation instructions.

pyenv install 3.8.12
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3 using python-build 20180424)

The log file generated contains the following error:

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.

@native-api
Copy link
Member

@DanielFNG #2143 (comment)

@native-api native-api changed the title Unable to install any python versions with pyenv in MacOS 11 Unable to install any python versions with pyenv in MacOS 11: "checking for the platform triplet based on compiler characteristics... darwin", "internal configure error for the platform triplet" Mar 16, 2022
@EugeneChung
Copy link

EugeneChung commented Mar 16, 2022

@native-api

  • Same here for MacOS Monterey 12.3 with M1 pro chip
  • env PYENV_DEBUG=1 pyenv install -v 3.6.10 2>&1 | tee trace.log
    trace.log

@DanielFNG
Copy link

DanielFNG commented Mar 16, 2022

@native-api

@DanielFNG #2143 (comment)

  • Platform information: MacOS Monterey 12.3
  • OS Architecture: ARM
  • pyenv version: 2.2.4
  • Python version: Attempting to install 3.8.12
  • C Compiler information (e.g. gcc 7.3): Apple clang version 13.1.6

Trace: trace.log

Did you find a fix for this? I have the same issue with the same specs as you

I have not, I've switched to using Python 3.9.10 for now which seems to work. This isn't ideal though as there may be some incompatibility issues with other software that I'm using.

@genewliu
Copy link

Need full diagnostic info as per the issue template and also config.log.

posted config.log at this thread
#2171 (comment)

it's the same config.log with versions of 3.8.x, 3.9.x

@pmc290630
Copy link

same issue with: MacOS 12.3, 2,6 GHz 6-Core Intel Core i7

pyenv install 3.9.4
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.4.tar.xz...
-> https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tar.xz
Installing Python-3.9.4...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/v_/c6f9rzdn49v7ncrkjp82dmjh0000gn/T/python-build.20220316131428.47575
Results logged to /var/folders/v_/c6f9rzdn49v7ncrkjp82dmjh0000gn/T/python-build.20220316131428.47575.log

Last 10 log lines:
checking for --with-cxx-main=... no
checking for clang++... no
configure:

By default, distutils will build C++ extension modules with "clang++".
If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found. Stop.

@olivierdolle
Copy link

I have some colleagues that are running into this issue now on both Mac with intel and M1 chips while trying to install python 3.7.12.
They have in common that they upgraded to MacOs 12.3 with the new xcode (13.3).
I haven't done the Macos upgrade yet (MacOS 12.2, xcode 13.2) and have no issue.

So it looks like the issue is somehow linked to xcode, but I have nothing more so far.

@mcouthon
Copy link

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

@genewliu
Copy link

genewliu commented Mar 16, 2022

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

Tried this but didn't work for me

(base) ... % CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.12.tar.xz...
-> https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz
Installing Python-3.8.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.2.1 using python-build 2.2.4-1-6-g44db3b03)

Inspect or clean up the working tree at /var/folders/1x/ct8q22c93hn49_82516b58nc0000gn/T/python-build.20220316231955.40493
Results logged to /var/folders/1x/ct8q22c93hn49_82516b58nc0000gn/T/python-build.20220316231955.40493.log

Last 10 log lines:
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
checking for gcc... /opt/homebrew/bin/gcc-11
checking whether the C compiler works... no
configure: error: in /var/folders/1x/ct8q22c93hn49_82516b58nc0000gn/T/python-build.20220316231955.40493/Python-3.8.12': configure: error: C compiler cannot create executables See config.log' for more details
make: *** No targets specified and no makefile found. Stop.

python-build.20220316231955.40493.log

@ananya77041
Copy link

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

Tried this as well and didn't work...
computer3336@Curatives-MacBook-Pro covid19lab % brew install gcc ==> Downloading https://ghcr.io/v2/homebrew/core/gmp/manifests/6.2.1_1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/gmp/blobs/sha256:a43a2ae4c44d90 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/isl/manifests/0.24 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/isl/blobs/sha256:be08c3e9765655 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/mpfr/manifests/4.1.0 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/mpfr/blobs/sha256:81ced499f237a ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/manifests/1.2.1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/libmpc/blobs/sha256:658a1d260b6 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.2-1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:7255929473878 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/gcc/manifests/11.2.0_3-1 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/homebrew/core/gcc/blobs/sha256:2d179246426328 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh ######################################################################## 100.0% ==> Installing dependencies for gcc: gmp, isl, mpfr, libmpc and zstd ==> Installing gcc dependency: gmp ==> Pouring gmp--6.2.1_1.arm64_monterey.bottle.tar.gz 🍺 /opt/homebrew/Cellar/gmp/6.2.1_1: 21 files, 3.2MB ==> Installing gcc dependency: isl ==> Pouring isl--0.24.arm64_monterey.bottle.tar.gz 🍺 /opt/homebrew/Cellar/isl/0.24: 73 files, 7MB ==> Installing gcc dependency: mpfr ==> Pouring mpfr--4.1.0.arm64_monterey.bottle.tar.gz 🍺 /opt/homebrew/Cellar/mpfr/4.1.0: 30 files, 5.2MB ==> Installing gcc dependency: libmpc ==> Pouring libmpc--1.2.1.arm64_monterey.bottle.tar.gz 🍺 /opt/homebrew/Cellar/libmpc/1.2.1: 12 files, 415.7KB ==> Installing gcc dependency: zstd ==> Pouring zstd--1.5.2.arm64_monterey.bottle.1.tar.gz 🍺 /opt/homebrew/Cellar/zstd/1.5.2: 31 files, 2.8MB ==> Installing gcc ==> Pouring gcc--11.2.0_3.arm64_monterey.bottle.1.tar.gz 🍺 /opt/homebrew/Cellar/gcc/11.2.0_3: 1,412 files, 338.3MB ==> Running brew cleanup gcc... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew`).
computer3336@Curatives-MacBook-Pro covid19lab % CC=/opt/homebrew/bin/gcc-11 pyenv install 3.9.7
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.7.tar.xz...
-> https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tar.xz
Installing Python-3.9.7...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.2.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/n_/cfryszs93f75bg2dv_f0zdvm0000gp/T/python-build.20220316082459.70559
Results logged to /var/folders/n_/cfryszs93f75bg2dv_f0zdvm0000gp/T/python-build.20220316082459.70559.log

Last 10 log lines:
./Modules/posixmodule.c: In function 'utime_fd':
./Modules/posixmodule.c:5177:1: warning: control reaches end of non-void function [-Wreturn-type]
5177 | }
| ^
./Modules/posixmodule.c: In function 'utime_default':
./Modules/posixmodule.c:5246:1: warning: control reaches end of non-void function [-Wreturn-type]
5246 | }
| ^
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....`

@Vash63
Copy link

Vash63 commented Mar 16, 2022

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

This does work (obviously substituting CC for where I installed gcc), but I'm not sure it's a valid fix to bypass Apple's default compiler when that's traditionally the only one supported on macOS platforms.

@NakedFerret
Copy link

Python 3.9.9 also installs correctly for me but the other versions do not.

From this comment I was able to figure out that during the python compilation, the configuration step checks the output of $CC --print-multiarch and compares it to the current environment. In the case of the M1 macs, this is causing some issues.

More concretely there's this snippet of code in the configure file of the cpython repo where the error originates

MULTIARCH=$($CC --print-multiarch 2>/dev/null)

if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
  PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d '        '`
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5
$as_echo "$PLATFORM_TRIPLET" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
$as_echo "none" >&6; }
fi
rm -f conftest.c conftest.out

if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
  if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
    as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5
  fi
elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
  MULTIARCH=$PLATFORM_TRIPLET
fi

The key line

if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x;

Has different values when configuring python 3.8.11 (VALUES: darwin arm64-apple-darwin21.4.0) compared to python 3.9.9 (VALUES: darwin ). The values for MULTIARCH are null in the 3.9.9 configure file. Which led me to find this snippet of code in the 3.9.9 repo.

if test x$PLATFORM_TRIPLET != xdarwin; then
  MULTIARCH=$($CC --print-multiarch 2>/dev/null)
fi

So I made this patch for python 3.8.11

diff --git a/configure b/configure
index 936f3d4596..33bdf8c6b9 100755
--- a/configure
+++ b/configure
@@ -5160,9 +5160,6 @@ $as_echo "$as_me:
 fi
 
 
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5
 $as_echo_n "checking for the platform triplet based on compiler characteristics... " >&6; }
 cat >> conftest.c <<EOF
@@ -5321,6 +5318,10 @@ $as_echo "none" >&6; }
 fi
 rm -f conftest.c conftest.out
 
+if test x$PLATFORM_TRIPLET != xdarwin; then
+  MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+fi
+
 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
     as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5

And used it while installing 3.8.11

pyenv install 3.8.11 --patch < python-3.8.11-m1.patch

Worked like a charm, and everyone here can make a patch for whatever version they would like to use.

Here's a short version of how I made the patch:

# Shallow clone of python version (much faster than deep clone)
git clone https://github.com/python/cpython --branch v3.8.11 --single-branch
cd cpython
# Make code changes here
git diff > python-3.8.11-m1.patch

And voila

@dinorrusso
Copy link

It appears as this issue impacts package installs as well; builds failing. My case: wxPython

@abhishekeb7
Copy link

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

Compiling with GCC worked for me.

Platform: macOS Monterey 12.3 with Intel chip.

@waipbmtd
Copy link

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

I tried this idea. Although there were warnings, but the installation was successful.

Platform: macOS Monterey 12.3 with M1 Chip.

install gcc

arch -x86_64 /usr/local/bin/brew install gcc

Decompress the tar.xz source file and compile:

arch -x86_64 ./configure --with-openssl=/usr/local/opt/openssl@3 --prefix=/Users/devin/.pyenv/versions/3.6.1 --libdir=/Users/devin/.pyenv/versions/3.6.1/lib CC=/usr/local/Cellar/gcc/11.2.0_3/bin/gcc-11 LDFLAGS="-L/usr/local/opt/bzip2/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@3/lib" CPPFLAGS="-I/usr/local/opt/bzip2/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@3/include" PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig"

make && make install

@MorvanL
Copy link

MorvanL commented Mar 16, 2022

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

Does not work for me
Apple M1 Pro
Mac os Monterey 12.2
Xcode 13.3

Last 10 log lines:
_PyFloat_GetInfo in libpython3.6m.a(floatobject.o)
__Py_dg_strtod in libpython3.6m.a(dtoa.o)
__Py_dg_strtod in libpython3.6m.a(dtoa.o)
ld: symbol(s) not found for architecture arm64
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1
(Mobeye-API) morvanlassauzay@MBP-de-Morvan Mobeye-API % CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.12.tar.xz...
-> https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz
Installing Python-3.8.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.2 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/3j/y12qkvv954s86yntf088871m0000gn/T/python-build.20220316181103.20885
Results logged to /var/folders/3j/y12qkvv954s86yntf088871m0000gn/T/python-build.20220316181103.20885.log

Last 10 log lines:
from ./Include/Python.h:121,
from Objects/memoryobject.c:13:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:328:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
328 | #if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:328:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:537:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
537 | #if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:537:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
(Mobeye-API) morvanlassauzay@MBP-de-Morvan Mobeye-API % pipenv sync

@dhalperi
Copy link

Python released a 3.7.13 version today , and patch versions for several other minor versions. This unblocks it for me, once pyenv has support for them.

@symbl-ay
Copy link

symbl-ay commented Mar 16, 2022

There are some comments here looking to build a python version with homebrew's openssl@3 that were doing so incorrectly, given you're on a newer version of macOS.

$>: PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.10.2
python-build: use openssl@3 from homebrew
...

I needed to include CC=$(brew --prefix gcc)/bin/gcc-11 since my arch command returned arm64 on my M1 chip. For versions > 3.9 (e.g., 3.6.15, 3.7.12, and 3.8.12) this extra flag wasn't necessary.

Here's an exhaustive summary:

$>: CC="$(brew --prefix gcc)/bin/gcc-11" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.6.15
$>: CC="$(brew --prefix gcc)/bin/gcc-11" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.7.12
$>: CC="$(brew --prefix gcc)/bin/gcc-11" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.8.12
$>: PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.9.10
$>: PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.10.2

There was no need to include any CFLAGS or LDFLAGS to the process.

@native-api
Copy link
Member

@symbl-ay

PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3"

Is that really necessary? openssl@3 is already used (since openssl is an alias to it) unless openssl@1.1 is installed, and CPython's OpenSSL 3 support is still experimental.

@symbl-ay
Copy link

Is that really necessary?

Nope. Not in the slightest. I agree that it's a bad idea. However, openssl@1.1 is stuck as the preferred option unless you change it, and the only other version I (and I think everyone else?) has to set it to is openssl@3. If anything, I wanted to see visual confirmation that the openssl version was in fact being changed, which I wasn't getting following other directions posted here.

prefer_openssl11() {
# Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl}"
export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA
}

@pitchblack408
Copy link

pitchblack408 commented Mar 16, 2022

Hi, I am having the same issue and I have tried some of the solutions above with no success.
MAC OS Monterey Version 12.2.1
8-Core Intel Core i9

xcode-select --install 
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
 softwareupdate --all --install --force                                                    
Software Update Tool

Finding available software
No updates are available.

brew install gcc
Warning: gcc 11.2.0_3 is already installed and up-to-date.
To reinstall 11.2.0_3, run:

Install failed with no gcc specified

pyenv install 3.8.12
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.2.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/v_/w2kwczpx221brkdh51chfshr0000gn/T/python-build.20220316153504.72637
Results logged to /var/folders/v_/w2kwczpx221brkdh51chfshr0000gn/T/python-build.20220316153504.72637.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... no
checking for clang++... no
configure:

 By default, distutils will build C++ extension modules with "clang++".
 If this is not intended, then set CXX on the configure command line.
  
checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found. Stop.

I tried specifying gcc and this is the other error
CC=/usr/local/bin/gcc-11 pyenv install 3.8.12

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.8.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.2.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/v_/w2kwczpx221brkdh51chfshr0000gn/T/python-build.20220316153729.73316
Results logged to /var/folders/v_/w2kwczpx221brkdh51chfshr0000gn/T/python-build.20220316153729.73316.log

Last 10 log lines:
                 from ./Include/Python.h:121,
                 from Objects/structseq.c:10:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:328:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
  328 | #if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:328:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:537:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
  537 | #if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:537:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]

@EugeneChung
Copy link

#2143 (comment) This works perfect.

Here is a diff for python 3.6.10.

diff --git configure configure
index e39c16eee2..2455870bf8 100755
--- configure
+++ configure
@@ -5202,10 +5202,6 @@ $as_echo "$as_me:
   " >&6;}
 fi

-
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5
 $as_echo_n "checking for the platform triplet based on compiler characteristics... " >&6; }
 cat >> conftest.c <<EOF
@@ -5334,6 +5330,10 @@ $as_echo "none" >&6; }
 fi
 rm -f conftest.c conftest.out

+if test x$PLATFORM_TRIPLET != xdarwin; then
+  MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+fi
+
 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
   if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
     as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5
@@ -9230,6 +9230,9 @@ fi
     	ppc)
     		MACOSX_DEFAULT_ARCH="ppc64"
     		;;
+    	arm64)
+    		MACOSX_DEFAULT_ARCH="arm64"
+    		;;
     	*)
     		as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
     		;;

@native-api
Copy link
Member

@EugeneChung you're welcome to make a PR adding this patch

@Vash63
Copy link

Vash63 commented Mar 17, 2022

I can confirm yesterday's releases 3.7.13, 3.8.13, 3.9.11 and 3.10.3 all work fine on my Intel mac. The GCC solution was not a viable one for me as it caused issues with pip modules that were built with clang. I don't think I need 3.6 or older branches at the moment but I suspect they might need manual patches via pyenv since they're EOL upstream.

@mcouthon
Copy link

I was able to solve by installing gcc with homebrew (brew install gcc), and specifying it as the GCC:

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.12

Indeed, the above ☝️ is no longer necessary (and, in fact, will cause issues with pip installing certain packages), so just use this instead 👇

I can confirm yesterday's releases 3.7.13, 3.8.13, 3.9.11 and 3.10.3 all work fine on my Intel mac. The GCC solution was not a viable one for me as it caused issues with pip modules that were built with clang. I don't think I need 3.6 or older branches at the moment but I suspect they might need manual patches via pyenv since they're EOL upstream.

@native-api
Copy link
Member

native-api commented Mar 18, 2022

Closing as per #2143 (comment):

I can confirm yesterday's releases 3.7.13, 3.8.13, 3.9.11 and 3.10.3 all work fine on my Intel mac. The GCC solution was not a viable one for me as it caused issues with pip modules that were built with clang. I don't think I need 3.6 or older branches at the moment but I suspect they might need manual patches via pyenv since they're EOL upstream.

The cause is a change in Apple Clang 13.0.0+ that made it incompatible with existing Python versions. Upgrade to the aforementioned newest Python versions to fix the issue.


For older releases, PRs with patches backporting python/cpython@9c47667 are welcome if someone is interested in supporting building them with that newer Clang.

@native-api native-api changed the title Unable to install any python versions with pyenv in MacOS 11: "checking for the platform triplet based on compiler characteristics... darwin", "internal configure error for the platform triplet" Unable to install any python versions with pyenv in MacOS 11-12: "checking for the platform triplet based on compiler characteristics... darwin", "internal configure error for the platform triplet" Mar 18, 2022
@joshfriend
Copy link
Member

Hi folks, if you see a comment that helps you, just 👍 to the comment instead of leaving new ones. Adding "me too" comments just creates noise for us maintainers to have to sift through.

If you have a new unique problem, please open new issues for them.

@pyenv pyenv locked as resolved and limited conversation to collaborators Mar 18, 2022
@pyenv pyenv deleted a comment from boblail Mar 18, 2022
@pyenv pyenv deleted a comment from atendron Mar 18, 2022
@pyenv pyenv deleted a comment from pbrewer-ifit Mar 18, 2022
@pyenv pyenv deleted a comment from genewliu Mar 18, 2022
@pyenv pyenv deleted a comment from leonardorhojas Mar 18, 2022
@pyenv pyenv deleted a comment from pbrewer-ifit Mar 18, 2022
@pyenv pyenv deleted a comment from John15321 Mar 18, 2022
@pyenv pyenv deleted a comment from ErikaJacobs Mar 18, 2022
@native-api native-api marked this as not a duplicate of #1737 Mar 20, 2022
@pyenv pyenv deleted a comment from jwaller-bbln Mar 20, 2022
@native-api
Copy link
Member

2all:
#2344 has backported the fix to 3.7.8+, 3.8.4+, 3.9.0+ (all versions that support MacOS 11+).
So this should be over now as long as you have Pyenv with that PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests