So for some context, I wanted to open a ipynb but it was showing a bunch of issues on vs code. Like many libraries that were installed weren't being recognised. The global version was 3.8.x and numpy, matplotlib, etc were installed and yet weren't being recognised even when the kernel was specifically set to 3.8.x. I had a few other versions I think some 3.9 which came by default with my mac, andit was showing some other kernel 3.12.x as recommended but i dont recall ever installing this so I had no idea where this came from. After trying to find a solution, i decided to wipe python from my system, and do a fresh clean install. I realised it may be best not to wipe the one in usr/bin so i left that and removed others.
Now I read somewhere that, the python in usr/bin shouldn't be messed with because that is the system python. So I decided it might be best not mess with that and do another install. So i installed pyenv.
Then for the python installation, i was following this FreeCodeCamp - How to Install Python 3 on Mac – Brew Install Update Tutorial
So I ran:
pyenv install 3.12.2
But I got this:
python-build: use openssl@3 from homebrew
python-build: use readline from homebrew
Downloading Python-3.12.2.tar.xz...
-> https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz
Installing Python-3.12.2...
python-build: use readline from homebrew
python-build: use ncurses from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 14.2.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/p7/mwgwt9vs4c15_87xt2gw_94m0000gn/T/python-build.20240225161607.89389
Results logged to /var/folders/p7/mwgwt9vs4c15_87xt2gw_94m0000gn/T/python-build.20240225161607.89389.log
Last 10 log lines:
__locale_setlocale in _localemodule.o
__locale_localeconv in _localemodule.o
__locale_localeconv in _localemodule.o
__locale_localeconv in _localemodule.o
__locale_localeconv in _localemodule.o
_libintl_textdomain, referenced from:
__locale_textdomain in _localemodule.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_freeze_module] Error 1
make: *** Waiting for unfinished jobs....
So I found somewhere that the solution might be to try and brew install openssl@3 and readline and xz. But they were all already installed.
Tried to run pyenv install 3.12.2 again, but to no avail.
Following this, tried running:
CC=/opt/homebrew/bin/gcc-11 pyenv install 3.12.2
but all i got was:
python-build: use openssl@3 from homebrew
python-build: use readline from homebrew
Downloading Python-3.12.2.tar.xz...
-> https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tar.xz
Installing Python-3.12.2...
python-build: use readline from homebrew
python-build: use ncurses from homebrew
BUILD FAILED (OS X 14.2.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/p7/mwgwt9vs4c15_87xt2gw_94m0000gn/T/python-build.20240225162236.6599
Results logged to /var/folders/p7/mwgwt9vs4c15_87xt2gw_94m0000gn/T/python-build.20240225162236.6599.log
Last 10 log lines:
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
checking for xcrun... yes
checking macOS SDKROOT... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
checking for gcc... /opt/homebrew/bin/gcc-11
checking whether the C compiler works... no
configure: error: in `/var/folders/p7/mwgwt9vs4c15_87xt2gw_94m0000gn/T/python-build.20240225162236.6599/Python-3.12.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
These are the log files: https://drive.google.com/drive/folders/1HQnp0K-WclIQXnkXmJOpGagd7uYKTGtw?usp=sharing
The linker cannot find essential symbols (
_libintl_bindtextdomain,_libintl_dcgettext, etc.) required by the_localemodule.oobject during the linking stage.Try installing gettext:
and then try reinstalling the python with the linking flags:
If the issue still persists, then try first clearing out the installation files and then try reinstalling
Uninstall the old files:
sudo rm -rf /Library/Developer/CommandLineToolsReinstall the cmd tools:
xcode-select --installand then try installing the
pyenv install 3.12.2