asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
667 stars 58 forks source link

Python ssl extension isn't compiled on macOS 10.13 High Sierra #20

Closed jeromedoyle closed 7 years ago

jeromedoyle commented 7 years ago

I currently have pyenv (1.1.5) and openssl (2.2.7) installed via homebrew. Installing 3.6.3 fails because the ssl extension wasn't compiled. The terminal output is:

asdf install python 3.6.3
python-build 3.6.3 /Users/jerome.doyle/.asdf/installs/python/3.6.3
Downloading Python-3.6.3.tar.xz...
-> https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
Installing Python-3.6.3...
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/pyenv/pyenv/wiki/Common-build-problems

BUILD FAILED (OS X 10.13 using python-build 1.1.5-8-g7b9d1a4)

Inspect or clean up the working tree at /var/folders/p6/k0c_hqr95_14y4z52gcq_zwm0000gn/T/python-build.20171018124832.29730
Results logged to /var/folders/p6/k0c_hqr95_14y4z52gcq_zwm0000gn/T/python-build.20171018124832.29730.log

Last 10 log lines:
            upgrade) ensurepip="--upgrade" ;; \
            install|*) ensurepip="" ;; \
        esac; \
         ./python.exe -E -m ensurepip \
            $ensurepip --root=/ ; \
    fi
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0
Cleaning up
jeromedoyle commented 7 years ago

I was able to get it to install properly by setting environment variables that tell the compiler where the openssl package is located as described here. The command was:

CFLAGS="-I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" asdf install python 3.6.3.

Should this be added to the docs?

danhper commented 7 years ago

Thanks for reporting. Yes, I think it is common enough so that we can add this to the docs here, with a reference to the pyenv page. Would you have time to send a PR for this please? Thank you.