Home > OS >  Pyenv: Not able to install python 3.x version MacOS 12.3.1
Pyenv: Not able to install python 3.x version MacOS 12.3.1

Time:04-21

I am not able to I have tried to install different version of python3.9.X (3.9.8, 3.9.9, 3.9.10, 3.9.11) and none of them are working. I have also tried some 3.8.X and 3.5.X all giving different errors. I will post the 3.9.8 log (the one I am interested on)

 Platform information: MacOS Monterey 12.3.1
 pyenv version: 2.2.5
 Python version: 3.9.8
 C Compiler information: Apple clang version 12.0.5 (clang-1205.0.22.9)
 Command used in pyenv: pyenv install 3.9.8 

This is my .zprofile (I am using oh-my-zsh)

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

I have also installed all the required dependencies

brew install openssl readline sqlite3 xz zlib

Here you can find the log and here you can find the config log

This is what I am getting:

@ pyenv install 3.9.8
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.8.tar.xz...
-> https://www.python.org/ftp/python/3.9.8/Python-3.9.8.tar.xz
Installing Python-3.9.8...
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/jl/hp_s9knj13x5ft7mffr258r40000gp/T/python-build.20220412182145.25030
Results logged to /var/folders/jl/hp_s9knj13x5ft7mffr258r40000gp/T/python-build.20220412182145.25030.log

Last 10 log lines:
if test $? -ne 0 ; then \
    echo "generate-posix-vars failed" ; \
    rm -f ./pybuilddir.txt ; \
    exit 1 ; \
fi
make: *** [Makefile:688: python.exe-gdb.py] Killed: 9
make: *** Waiting for unfinished jobs....
/bin/sh: line 5: 33970 Killed: 9               ./python.exe -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [Makefile:618: pybuilddir.txt] Error 1  

CodePudding user response:

I spent a couple of days with the issue and I found the answer on the GitHub Issues.
The problem was the antivirus as documented here.

Once the Antivirus was disabled everything was installed without any error (I tried python 3.9.8, 3.9.9, 3.9.10, 3.9.11). I had Apex One (Mac) Antivirus and uninstalling was not trivial. This guide was helpful.

I used Those two commands:

sudo launchctl unload /Library/LaunchDaemons/com.trendmicro.* /Library/LaunchAgents/com.trendmicro.*
sudo kill -9 $(pgrep iCoreService TmLoginMgr)

If you recieve this warning is completly fine

Warning: Expecting a LaunchDaemons path since the command was ran as root. Got LaunchAgents instead.
`launchctl bootout` is a recommended alternative.
/Library/LaunchAgents/com.trendmicro.TmLoginMgr.plist: Could not find specified service
Unload failed: 113: Could not find specified service

Just check your Icon on the top bar is gone.
Additionally you can make sure this command does not return any process:

pgrep iCoreService TmLoginMgr MainUI
  • Related