Skip to content
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

OS X 10.11 pyenv install [resolved] #429

Closed
impressiver opened this issue Aug 19, 2015 · 9 comments

Comments

@impressiver
Copy link

commented Aug 19, 2015

This isn't an issue so much as a note to anyone else who might run into something similar. I tried installing python 2.7.10 on OS X 10.11 beta and ran into an old problem ( #263 ). The end of the Python install logs were less than helpful:

...
if test "xno" != "xno"  ; then \
        case no in \
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi

That was the end of it. Not much to go on. Then I found and ran pyenv doctor, which was nice enough to spit out a much more illuminating error message before it pooched:

...
BUILD FAILED (OS X 10.11 using python-build 20150519)

Inspect or clean up the working tree at /var/folders/x_/m5jlq_2x13xf2g84qtv_gshc0000gn/T/python-build.20150818234524.43916
Results logged to /var/folders/x_/m5jlq_2x13xf2g84qtv_gshc0000gn/T/python-build.20150818234524.43916.log

Last 10 log lines:
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: OpenSSL development header is not installed.
Problem(s) detected while checking system.

See https://github.com/yyuu/pyenv/wiki/Common-build-problems for known solutions.

(HINT: it's the part about OpenSSL, there's a note about it on that link)

The wiki entry does in fact include everything required to fix the problem, but it's not all in the same copy-pasteable block. After a few tries, I stumbled on the magic combo:

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

(sub 2.7.10 for whatever version you want to install)

Combining the xcrun and openssl include/lib paths is like summoning Captain Python.

@bertjwregeer

This comment has been minimized.

Copy link

commented Sep 13, 2015

If you install OpenSSL from hombrew, since Apple no longer ships the OpenSSL headers, you could run:

brew link --force openssl
@yyuu

This comment has been minimized.

Copy link
Collaborator

commented Sep 21, 2015

Actually python-build is already configured to find openssl from brew's prefix if it is available. With this code, you don't have to do brew link --force openssl.

https://github.com/yyuu/pyenv/blob/43eb33e9295816a79858f5174ae487504476a489/plugins/python-build/bin/python-build#L1265

@yyuu

This comment has been minimized.

Copy link
Collaborator

commented Sep 21, 2015

@impressiver I suspect you didn't have Command Line Tools for Xcode at that time and you also didn't have openssl headers in /usr/include/openssl. I'm not sure if Command Line Tools for Xcode is available for 10.11 Beta, but apparently pyenv needs openssl headeres in either /usr/include or brew's prefix.

The summoning is required if your system doesn't have proper installation of Command Line Tools for Xcode and doesn't have brew's openssl. If you prefer simpler way, I'd recommend you to install brew and brew install openssl. It also requires Command Line Tools for Xcode, though.

Anyway, if you find something is missing on the Wiki documentations, feel free to update the document as need. Everyone can edit.

@yyuu yyuu closed this Sep 21, 2015

@bertjwregeer

This comment has been minimized.

Copy link

commented Sep 21, 2015

Unfortunately it seems that unless I do as I mentioned above (brew link --force openssl) the builds will not pick up the OpenSSL installed as a keg:

alexandra:~ xistence$ pyenv install 2.6.9
Downloading Python-2.6.9.tgz...
-> https://yyuu.github.io/pythons/7277b1285d8a82f374ef6ebaac85b003266f7939b3f2a24a3af52f9523ac94db
Installing Python-2.6.9...
patching file setup.py
Hunk #1 succeeded at 354 (offset 9 lines).
patching file ./configure
patching file ./Modules/readline.c
Hunk #1 succeeded at 199 (offset -7 lines).
Hunk #2 succeeded at 698 (offset -51 lines).
Hunk #3 succeeded at 808 (offset -51 lines).
Hunk #4 succeeded at 848 with fuzz 2 (offset -70 lines).
patching file ./setup.py
Hunk #1 succeeded at 1698 (offset 23 lines).
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

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/_l/cx3x95zs4yn6kb1ndy03yrzm0000z9/T/python-build.20150920235324.84808
Results logged to /var/folders/_l/cx3x95zs4yn6kb1ndy03yrzm0000z9/T/python-build.20150920235324.84808.log

Last 10 log lines:
    then rm -f /Users/xistence/.pyenv/versions/2.6.9/bin/python; \
    else true; \
    fi
(cd /Users/xistence/.pyenv/versions/2.6.9/bin; ln python2.6 python)
rm -f /Users/xistence/.pyenv/versions/2.6.9/bin/python-config
(cd /Users/xistence/.pyenv/versions/2.6.9/bin; ln -s python2.6-config python-config)
Creating directory /Users/xistence/.pyenv/versions/2.6.9/share/man
Creating directory /Users/xistence/.pyenv/versions/2.6.9/share/man/man1
/usr/bin/install -c -m 644 ./Misc/python.man \
        /Users/xistence/.pyenv/versions/2.6.9/share/man/man1/python.1
alexandra:~ xistence$ 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.1j (431 files, 15M)
  Poured from bottle
/usr/local/Cellar/openssl/1.0.1j_1 (431 files, 15M)
  Poured from bottle
/usr/local/Cellar/openssl/1.0.2 (459 files, 18M)
  Poured from bottle
/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
==> Dependencies
Build: makedepend ✘
==> Options
--universal
    Build a universal binary
--without-check
    Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

The build correctly picks up OpenSSL if I brew link --force openssl

@yyuu

This comment has been minimized.

Copy link
Collaborator

commented Sep 21, 2015

@bertjwregeer Umm. Sorry my bad. The use_homebrew_openssl will never be invoked with current pyenv impl. I'll try to fix the python-build to use it. Thanks for letting me know.

@yyuu yyuu reopened this Sep 21, 2015

yyuu added a commit that referenced this issue Sep 21, 2015
@yyuu

This comment has been minimized.

Copy link
Collaborator

commented Sep 21, 2015

@bertjwregeer e52ed97 should install use brew's openssl if it's available, or install openssl from source. Can you give it a try?

@bertjwregeer

This comment has been minimized.

Copy link

commented Sep 21, 2015

Yup, will give it a try when I get back from work.

@yyuu

This comment has been minimized.

Copy link
Collaborator

commented Sep 23, 2015

I merged ^ changes into master branch. With latest master, python-build should build & install openssl if it is not available via both Xcode and Homebrew. This should solve the issue of missing OpenSSL library intrinsically.

Feel free to reopen if you still have some issues.

@yyuu yyuu closed this Sep 23, 2015

@geryit

This comment has been minimized.

Copy link

commented Oct 10, 2015

Had the same issue,
$ xcode-select --install
fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.