Error while installing python on Big Sur 11.1 with Pyenv [closed]
Asked Answered
S

0

24

When I run

pyenv install 3.8.0

This is my command line errors:

jazab@Jazabs-MacBook-Pro ~ % pyenv install 3.8.0
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/1z/s1vxbsqs503drc76hq8njghr0000gn/T/python-build.20201224183625.52487
Results logged to /var/folders/1z/s1vxbsqs503drc76hq8njghr0000gn/T/python-build.20201224183625.52487.log

Last 10 log lines:
                                                     ^
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jazab/.pyenv/versions/3.8.0/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include  -DPy_BUILD_CORE_BUILTIN  -c ./Modules/_sre.c -o Modules/_sre.o
./Modules/posixmodule.c:9084:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        ret = sendfile(in, out, offset, &sbytes, &sf, flags);
              ^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
Shrubbery answered 24/12, 2020 at 23:39 Comment(9)
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)Cetane
Try this one github.com/pyenv/pyenv/issues/1740#issuecomment-738749988Stesha
Thanks @smartworld-dm, this helped solve my issue. I think you should post this as an answerDromedary
The problem are related here github.com/pyenv/pyenv/issues/1740Boo
Try this: pyenv install 3.8.0 --patch < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch)Boo
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" \ pyenv install --patch 3.7.3 < <(curl -sSL github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) ----> change the version as you wishFishmonger
Part of the confusion in the multiple tickets in the pyenv GitHub repo is that what works also depends on which libraries you have previously installed in Homebrew. The proper fix would be for Homebrew to sort this out in their pyenv package; there seems to be a recent update to that so maybe they have now.Urban
For what it's worth, there is absolutely no reason to backslash the equals sign in full_index=1. Newer versions after sometime midway in the 3.8.x series do not require the patch.Urban
The patch method mentioned by Bruno works for me and I am on Big Sur 11.3.1 and Xcode 12.5Portuna

© 2022 - 2024 — McMap. All rights reserved.