Issues installing Python 3.8.10 on macOS 12.3 Monterey
Asked Answered
D

8

35

Anyone having issues installing python 3.8.10 on macOS Monterey M1 Mac? Any version I try to install using pyenv install gives me this error:

python-build: use [email protected] from homebrew python-build: use readline from homebrew Downloading Python-3.8.10.tar.xz... -> https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tar.xz Installing Python-3.8.10... 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/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129 Results logged to /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129.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've tried almost all questions across Google Search without success =(. I've tried to install using asdf python plugin and pyenv.

Discontinuance answered 22/3, 2022 at 19:6 Comment(0)
B
41

Apple introduced a change that resulted in its breaking.

In your specific case pyenv install 3.8.13 should work.

For others on different versions should check this thread

Or use any of these versions 3.7.13, 3.8.13, 3.9.11 and 3.10.3

Bacteria answered 7/4, 2022 at 9:10 Comment(3)
"...Or use any of these versions 3.7.13, 3.8.13, 3.9.11 and 3.10.3" >> Great! These patches are very important as they allow to install any of the minor versions that otherwise can't be installed. May be you could add some bold here rahulg.Corenda
3.7.13, 3.8.13, 3.9.11 and 3.10.3 ^ seconded, this is great infoAbove
for python 3.6 i was able to install version 3.6.15 (pyenv install 3.6.15) - macOS Monterey v12.0.1Orography
H
15

This worked for me.

Install gcc first;

brew install gcc

And then with gcc run pyenv installation.

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

enter image description here

Himelman answered 24/3, 2022 at 14:3 Comment(2)
I got the hint to get past this issue from this response. I installed gcc using homebrew but slightly changed the pyenv command CC=gcc pyenv install 3.9.12Particularity
Turns out my homebrew-installed gcc lives under /usr/local/Cellar/gcc/11.2.0_3/bin/gcc-11, so I had to modify the command accordingly.Eolic
L
14
brew install gcc && CC=`which gcc-11` pyenv install 3.8.10
Laktasic answered 11/4, 2022 at 17:32 Comment(1)
Thanks! I don't know why but setting the compiler to gcc-11 worked. Seems to have something to do with clang I guessMandelbaum
S
3

It doesn't need to install gcc with brew! It might fall you in trouble much more!

There is a bundled gcc in Apple Command Line Tools which you can find it through below command:

which gcc

Be careful to don't add any version specific number to gcc! something like gcc-11 or gcc-12 and so etc. Then check the found gcc is located under /Library/Developer/CommandLineTools/ directory. The desired output would be something like this:

$ which gcc
/Library/Developer/CommandLineTools/usr/bin/gcc

If everything is Ok, mean you run simple which gcc command and it found gcc and the found path is under /Library/Developer/CommandLineTools/ directory, you can install your python through pyenv using following command:

CC=`which gcc` pyenv install 3.8.6

you can install any version of python which is available and you need.

If you faced to any issue please comment it, it might help us to make answer more clear and helpful to you.

Squid answered 25/8, 2022 at 11:32 Comment(3)
my which gcc shows /usr/bin/gcc path, how to switch to /Library/Developer/CommandLineTools/usr/bin/gcc ?Orography
but gcc --version shows InstalledDir: /Library/Developer/CommandLineTools/usr/binOrography
@Orography CC=`which gcc` pyenv install 3.8.6 finds gcc bin automatically and set CCto the path of found bin! if your version is different gcc bin, you must set CC manually to the path of your desired gcc bin! something like CC=`/Library/Developer/CommandLineTools/usr/bin` pyenv install 3.8.6 without asking which to find it!Squid
V
3

Me help as:

brew install gcc@11

after:

CC=`which gcc-11` pyenv install 3.8.12
Vittle answered 6/9, 2022 at 4:52 Comment(0)
E
1

I faced the same issue. I realized my pyenv version was out of date. I updated it using homebrew by running:

brew install pyenv

and then running

pyenv install 3.10.6

worked flawlessly.

Enriqueenriqueta answered 1/9, 2022 at 16:44 Comment(0)
T
0

Hey this linked really helped: https://developer.apple.com/forums/thread/703557

It seems you can download 3.8.13 fine if you installed it via homebrew.

Therianthropic answered 27/10, 2023 at 20:32 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Madelinemadella
C
-3

I faced the same issue and the solution that worked for me was to install the version manually, here are the steps I performed to get it done:

  1. Download the python-3.8.10 version here: https://www.python.org/downloads/release/python-3810/
  2. Once downloaded, double-click to install through the installation wizard.
  3. Once completed, from finder or terminal open the directory where it got installed: /Applications/Python 3.8
  4. Run the Install Certificates.command, wait until it completes.
  5. In the same path, run Update Shell Profile.command
  6. You are all set, to validate it run from the terminal: python3 --version

To setup a virtual environment for python version 3.8.10 installed manually:

  1. pip install --upgrade pip
  2. pip install virtualenv
  3. cd my_project_folder/
  4. virtualenv venv
  5. source venv/bin/activate
  6. To deactivate once finish working, run: deactivate

You can get more information about setting up the virtual environment here: https://virtualenv.pypa.io/en/latest/user_guide.html#

Calamitous answered 24/3, 2022 at 22:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.