-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
macOS High Sierra: ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? #993
Comments
I can finish this step successfully. first: and Homebrew said both readline and openssl is keg-only. so I wrote a .sh file to export environment variables:
every time I want install a Python:
I failed at the step of installing pip, cause of could not build the pyexpat module. Hope helpful, and wish I can install 2.7.13 & 3.6.2 |
I'm currently experiencing this issue on a clean install of High Sierra. I was able to get openssl recognized using the above script, however I'm now failing because |
I would suggest removing the old installation and install using homebrew. The problem turned out to be the openssl hadn't actually successfully installed (even though homebrew reported that it had). run |
or simply, |
@uber1geek You are right. Do not install pyenv via pyenv-installer, instead of brew. |
This can be solved pretty easily without installing homebrew. See my comment here #950 (comment) |
I started getting this issue once I upgraded to High Sierra. I followed the instructions above to uninstall and reinstall openssl and it fixed the issue -- I can now compile python successfully. Thanks! |
|
I was running into the same issue on High Sierra after installing pyenv, xz, readline, and openssl all from homebrew.. but as @Voleking stated, setting CFLAGS and LDFLAGS works.. to not have to type it in every time just add the following alias to your .profile, .bashrc, .zshrc or whatever..
|
I have the same problem, even when setting Any other suggestions that worked? Edit: I missed the earlier comment where readline was installed as keg-only. The additional flags from @BruceFrankWang work. |
@wdeer , this actually makes your shell start up a lot of slower, as the commands included in alias are being expanded every time the shell is run. On my 2015 MBP it gives a few seconds of delay. I came here because I also have the same problem. Looking into other solutions. EDIT: it looks like MacPorts are more than enough for me. No problems with installing different Python versions, I'm happily running 27, 33, 34, 35, 36 side-by-side. I do realise pyenv has a different scope of usage, but for Mac users who want to have different versions of Python, I'd say -- go MacPorts. Homebrew ATM does not support multiple Python versions. |
Guys if you're using brew and you hit this problem, the most recent version actually works now... Run these commands: |
I got it working in macOS High Sierra 10.13.1 by installing openssl using |
Did what @sanghapriya said and it worked. $ brew install openssl Added to my export CFLAGS="-I$(brew --prefix openssl)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib" and ran it again: $ brew install pyenv --HEAD After installing a new version, I still got the old version on my console, even after selecting it with The solution was to add that to my export PATH="/Users/REPLACE_IT_WITH_YOUR_USERNAME/.pyenv:$PATH"
eval "$(pyenv init -)" |
Here's my solution:
|
I think this issue was fixed by #1025 which means that it's fixed in pyenv 1.2.0. I guess this issue can close? |
@jenshnielsen I had this issue and just using latest versions of all mentioned packages worked. |
This issue still happens #1066 (comment) |
@schinwang Solution works for me, upgrading brew pkgs resolved the issue. |
I fixed this simply by updating pyenv: |
I am seeing this failing again with python 3.7 betas. This seems to be due to https://bugs.python.org/issue32598 improving openssl configuration options. For homebrew the following seems to work.
|
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.
afterward, I was able to install ruby and python versions |
Hey guys, I just |
I just wasted my entire morning fighting this issue on OSX Sierra 10.12.6 (not High Sierra). I was running pyenv installed from the bash script pyenv-installer. I tried just about every solution from installing openssl via brew, to uninstalling openssl and reinstalling, to downloading the headers and setting the include separately, to including CPPFLAGS as well as CFLAGS settings. Nothing worked! The ONLY solution for me was to install pyenv via brew and delete the version installed via the pyenv-installer. I don't like installing programs in root folders and would have rather used the pyenv-installer since it puts things in my home dir but this was the only solution. |
@cliff76 I had everything installed via After that it installed fine via pyenv :) |
I had to run - |
The fixes are described here: pyenv/pyenv#993
This issue is being exacerbated to an insane degree by the fact that apparently Brew refuses to host openSSL 1.0.2t instead opting for 1.1.1 only; Python 2.7 can't function with 1.1.1 (apparently) and so I'm stuck at this error over and over again:
|
Same issue trying to install python 3.5.2 which is apparently compatible with openssl 1.1: CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" asdf install python 3.5.2
python-build 3.5.2 /Users/adamlancaster/.asdf/installs/python/3.5.2
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.5.2.tar.xz...
-> https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
Installing Python-3.5.2...
patching file Lib/venv/scripts/posix/activate.fish
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
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.15.2 using python-build 1.2.16-2-g36fc10fb)
Inspect or clean up the working tree at /var/folders/gm/84m52gh16sx9g7l_gln_w77r0000gn/T/python-build.20200113113216.50262
Results logged to /var/folders/gm/84m52gh16sx9g7l_gln_w77r0000gn/T/python-build.20200113113216.50262.log
Last 10 log lines:
(cd /Users/adamlancaster/.asdf/installs/python/3.5.2/share/man/man1; ln -s python3.5.1 python3.1)
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
./python.exe -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS Have tried re-installing openssl with brew nothing works |
For those still having the same issue please try the steps below. None of the solutions above worked for me. It turns out I need to let pyenv install his own compatible openssl version
You will see then that it is installing a different version from the latest openssl version Good luck! |
@joony0123 's suggestion worked perfectly for me! I managed to fix pyenv install for 3.7.X by reinstalling Xcode command line tools, but it still didn't work for 2.XX versions. I had openssl 1.1 installed through home-brew, but it didn't occur to me that the earlier versions of python weren't compatible with [email protected]. This is what I did to get everything working on my system. (adapted a bit of @joony0123's)
open up Xcode GUI and allow it to complete the installation of some more packages finally, Running on 10.15.2 Catalina Hope this helps! So finally I opened xcode Gui and it had some remaining packages to install |
None of the solutions above seem to work with Python 2.6.0 (they do with > 2.7). Any ideas for this specific version? |
@joony0123's solution worked for me, where every other mechanism (CPPFLAGS, LDFLAGS) did not. Uninstalling brew's openssl makes pyenv download a compatible openssl which it then installs in its private directory, and which it successfully builds python against. Then you can reinstall brew's openssl to restore the functionality of its dependents. macOS Mojave 10.14.6, pyenv-1.12.16, Python-3.5.2 with openssl-1.0.2k. |
It worked for me,because if I ran brew install openssl, it installed [email protected] and it didn't work for me , still said no OpenSLl, and I use this method solve it ,and it installed openssl-1.0.2k, thanks |
you cannot use 'brew uninstall --ignore-dependencies [email protected]' then you can install a python version older than 2.7.13 with its own old version of openssl |
For reference, I didn't have to uninstall [email protected] from homebrew, but rather, install a more updated version of python 2.7. After installing
It seems some versions of python2 won't work with openssl 1.1, which was deprecated from homebrew, even when explicitly set using env flags. |
sudo PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v 2.7.6 it's seem use for me. |
For someone encountering this error message when installing PyPy, this is a bug in PyPy 7.3.1: https://foss.heptapod.net/pypy/pypy/issues/3229 |
On macOS Catalina, I met this error message when installing PyPy 7.3.1. However, when changing to PyPy 7.3.0, errors disappear. Thanks! |
Has anyone been able to install 2.5.6 on macOS using homebrew? It seems the the script
|
This problem is worsened by the pyenv build process identifying the OpenSSL version belatedly, partway into the compilation instead of at the very beginning. Each debug iteration takes several minutes to fail, so the user has little information to work with. As a workaround, I upgraded my Python from 3.4.3 to 3.9.2. |
Summary of possible reasons and solutions is at https://github.com/pyenv/pyenv/wiki/Common-build-problems#error-the-python-ssl-extension-was-not-compiled-missing-the-openssl-lib |
This is pretty over the top but what finally ended up working for me (M1), but I ended up adding this to my Assumes you have the various listed packages installed via homebrew. Here it is: # Standard pyenv stuff
export PATH=/usr/local/bin:$PATH
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# The pyenv alias function
function bradley_pyenv {
if [[ $1 == "install" ]]; then
print -P "%F{cyan}Executing 'pyenv' as alias to 'bradley_pyenv'. See .zshrc for details!%f"
# The following section configures various flags necessary to get pyenv
# working with our OS. Please update as any of these details change, e.g.;
# the OSX version or deployment target.
# about readline
LDFLAGS="-L$(brew --prefix readline)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix readline)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix readline)/include $CFLAGS"
# about openssl
LDFLAGS="-L$(brew --prefix openssl)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix openssl)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix openssl)/include $CFLAGS"
# about tcl-tk
LDFLAGS="-L$(brew --prefix tcl-tk)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix tcl-tk)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix tcl-tk)/include $CFLAGS"
# about zlib
LDFLAGS="-L$(brew --prefix zlib)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix zlib)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix zlib)/include $CFLAGS"
# about bzip2
LDFLAGS="-L$(brew --prefix bzip2)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix bzip2)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix bzip2)/include $CFLAGS"
# about sqlite3
LDFLAGS="-L$(brew --prefix sqlite3)/lib $LDFLAGS"
CPPFLAGS="-I$(brew --prefix sqlite3)/include $CPPFLAGS"
CFLAGS="-I$(brew --prefix sqlite3)/include $CFLAGS"
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include $CFLAGS"
SDKROOT="$(xcrun --show-sdk-path)"
MACOSX_DEPLOYMENT_TARGET=13.3
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3"
PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2
CC="$(brew --prefix gcc)/bin/gcc-13"
# Execute custom pyenv command...
command arch -x86_64 pyenv "$@"
else
# Execute as normal...
command pyenv "$@"
fi
}
alias pyenv=bradley_pyenv |
I am having this issue on mac os high sierra(10.13) even with setting CFLAGS and LDFLAGS correctly using brew --prefix
The text was updated successfully, but these errors were encountered: