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

Can't compile any versions of python on El Capitan #451

Closed
Feiox opened this Issue Oct 4, 2015 · 27 comments

Comments

Projects
None yet
@Feiox

Feiox commented Oct 4, 2015

I'm also having this problem with ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib or ERROR: The Python zlib extension was not compiled. Missing the zlib?

I am running a clean install of El Capitan 10.11 instead of an upgrade. I have tried all the solutions below:

but the same error ~~~~~ T_T

Here is the full error msg:

Downloading Python-2.7.10.tgz...
-> https://yyuu.github.io/pythons/eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a
Installing Python-2.7.10...
patching file ./Lib/site.py
ERROR: The Python zlib extension was not compiled. Missing the zlib?

Please consult to the Wiki page to fix the problem.
https://github.com/yyuu/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.11 using python-build 20150818)

Inspect or clean up the working tree at /var/folders/hl/zb01qhxx29g1yx0p869qyt9r0000gn/T/python-build.20151004100320.23104
Results logged to /var/folders/hl/zb01qhxx29g1yx0p869qyt9r0000gn/T/python-build.20151004100320.23104.log

Last 10 log lines:
rm -f /Users/Feiox/.pyenv/versions/2.7.10/share/man/man1/python.1
(cd /Users/Feiox/.pyenv/versions/2.7.10/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno"  ; then \
        case no in \
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi

install py 2.7.10, err msg:

Downloading Python-2.7.10.tgz...
-> https://yyuu.github.io/pythons/eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a
Installing Python-2.7.10...
patching file ./Lib/site.py
ERROR: The Python zlib extension was not compiled. Missing the zlib?

Please consult to the Wiki page to fix the problem.
https://github.com/yyuu/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.11 using python-build 20150818)

Inspect or clean up the working tree at /var/folders/hl/zb01qhxx29g1yx0p869qyt9r0000gn/T/python-build.20151004100320.23104
Results logged to /var/folders/hl/zb01qhxx29g1yx0p869qyt9r0000gn/T/python-build.20151004100320.23104.log

Last 10 log lines:
rm -f /Users/Feiox/.pyenv/versions/2.7.10/share/man/man1/python.1
(cd /Users/Feiox/.pyenv/versions/2.7.10/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno"  ; then \
        case no in \
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi
@yyuu

This comment has been minimized.

Collaborator

yyuu commented Oct 4, 2015

I'm still using Yosemite. Probably you don't have OpenSSL headers in /usr/include.

This isn't intrinsic fix but reinstalling pyenv from latest github repo would help since it tries to use brew's openssl otherwise build it by itself.

@Feiox

This comment has been minimized.

Feiox commented Oct 4, 2015

@yyuu OpenSSL and zlib has been installed from brew.
I also try to install pyenv from latest github repo, but the same error msg ---> T_T

P.S. Did Apple's new security policy cause the problem? Would you choose to upgrade?

@thomasjo

This comment has been minimized.

Contributor

thomasjo commented Oct 4, 2015

I just installed Python 2.7.10 on El Capitan (15A284) without any problems. This is definitely an environment problem, and not a problem with pyenv.


➜  ~  pyenv install 2.7.10
Downloading Python-2.7.10.tgz...
-> https://yyuu.github.io/pythons/eda8ce6eec03e74991abb5384170e7c65fcd7522e409b8e83d7e6372add0f12a
Installing Python-2.7.10...
patching file ./Lib/site.py
Installed Python-2.7.10 to /Users/thomasjo/.pyenv/versions/2.7.10

➜  ~  pyenv --version
pyenv 20150913-14-gd462e15
➜  ~  brew info openssl
openssl: stable 1.0.2d (bottled)
OpenSSL SSL/TLS cryptography library
https://openssl.org/

This formula is keg-only.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

/usr/local/Cellar/openssl/1.0.2d_1 (464 files, 17M)
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/openssl.rb
...
@Feiox

This comment has been minimized.

Feiox commented Oct 4, 2015

@thomasjo I am running a clean install of El Capitan instead of an upgrade, so do you?
I saw some people in other issues that had the same problem. It should not be a case that exist only on my mac.
I try to compile install python and python3 from homebrew and official source package, then everything is normal. T_T Where else may be wrong?

@thomasjo

This comment has been minimized.

Contributor

thomasjo commented Oct 4, 2015

@Feiox Yep, clean install. Only thing I can think of that might affect this is that I have Anaconda installed, and set up as a system-level python (e.g. python global system anaconda3-2.3.0).

@ccqpein

This comment has been minimized.

ccqpein commented Oct 4, 2015

I have the same issues, and I use El Capitan too.

Even I install the zlip by brew, the problem is same.
I use

CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.4.3

And it doesn't work either:

zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

BUILD FAILED (OS X 10.11 using python-build 20150818)

What can I do?

@ccqpein

This comment has been minimized.

ccqpein commented Oct 4, 2015

Well, I succeed install with the #448 solution:

CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.5.0
@Feiox

This comment has been minimized.

Feiox commented Oct 5, 2015

@ccqpein @yyuu I tried to reinstall the system again, then #448 solution makes my mac normal.
Why do I use this solution the last time it invalid? (◜◔。◔◝)

THX ~

@Feiox Feiox closed this Oct 5, 2015

@echoyangyang

This comment has been minimized.

echoyangyang commented Oct 27, 2015

Okay...I browsed throughout the Internet....Finally I it's the x-code tool problem.
on your terminal,
xcode-select --install
then,
pyenv install 3.5.0

That's solved my problem.
May this can help you.

@nguyenchiencong

This comment has been minimized.

nguyenchiencong commented Nov 18, 2015

👍

@arcseldon

This comment has been minimized.

arcseldon commented Nov 21, 2015

El Capitan is like the "gift" that keeps on giving... @312024196 thank you, your solution worked a charm.

@echoyangyang

This comment has been minimized.

echoyangyang commented Nov 21, 2015

@arcseldon Glad to help you :>

@shixudongleo

This comment has been minimized.

shixudongleo commented Jan 4, 2016

xcode-select --install

solve my problem.

@woolf-wen

This comment has been minimized.

woolf-wen commented Sep 12, 2016

@ccqpein, ur solution solve my problem

@ssbarnea

This comment has been minimized.

ssbarnea commented Nov 11, 2016

xcode-select --install solved the problem for me but I would find it more useful if pyenv would detect this itself.

@HerveNivon

This comment has been minimized.

HerveNivon commented Feb 9, 2017

Problem is still here, xcode-select --install solved it too for me.

@jshin49

This comment has been minimized.

jshin49 commented Feb 21, 2017

For zlib, i had the same problem

This worked for me after installing zlib with brew

CFLAGS="-I/usr/local/opt/zlib/include"
LDFLAGS="-L/usr/local/opt/zlib/lib"
pyenv install -v 3.4.5

@thetylerwolf

This comment has been minimized.

thetylerwolf commented May 2, 2017

I'm running OS X Sierra and the above didn't help for me. Found this solution here: https://medium.com/@pimterry/setting-up-pyenv-on-os-x-with-homebrew-56c7541fd331
and it did work.


CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \
PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \
pyenv install -v 3.6.0
@hshinde

This comment has been minimized.

hshinde commented Oct 29, 2017

I was facing the problem with Python installation through all other mediums, but this is the only method worked for me.
xcode-select --install
then,
pyenv install 3.6.0a1

Thanks @echoyangyang

@xijieqjx

This comment has been minimized.

xijieqjx commented Dec 14, 2017

macos 10.13.2
xcode-select --install is success
thanks

@GusGA

This comment has been minimized.

GusGA commented Feb 4, 2018

I know, it a close issue but today Feb/4/18.
xcode-select --install do the trick

@tdibacco

This comment has been minimized.

tdibacco commented Mar 17, 2018

ditto, worked for me.
macOS 10.13.3
xcode-select --install

@jalevin

This comment has been minimized.

jalevin commented Apr 19, 2018

Besides pyenv I also could not install ruby versions via rbenv. At this point I started looking at the system. I'd recently upgraded and used the migration assistant to move to a new machine.

  1. go to Applications and run Xcode. I had additional packages install
  2. run brew doctor. if any files in /usr/local/include show up you have 2 options. Either rename the directory to something else like include_old or remove the offending entries. I chose the first.

sudo mv /usr/local/include /usr/local/include_old
sudo mkdir /usr/local/include
sudo chown $YOU_USERNAME:admin /usr/local/include

afterward, I was able to install ruby and python versions

@paustin01

This comment has been minimized.

paustin01 commented Jul 26, 2018

xcode-select --install worked for me on High Sierra as well.

@0x3333

This comment has been minimized.

0x3333 commented Oct 9, 2018

On Mojave:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
@leejongyoung

This comment has been minimized.

leejongyoung commented Oct 10, 2018

@ccqpein

It is work!!
Thank you very much for your help

Error Msg

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 readline from homebrew

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

Solved Command

CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.6.6

Result Msg

Installed Python-3.6.6 to /Users/leejongyoung/.pyenv/versions/3.6.6
@joshfriend

This comment has been minimized.

Member

joshfriend commented Oct 10, 2018

Zlib not being found on mojave is a separate issue: #1219

@pyenv pyenv locked as resolved and limited conversation to collaborators Oct 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.