Closed geowa4 closed 5 years ago
I had the same issue.
My workaround:
$ brew install zlib
$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"
$ export KEEP_BUILD_PATH=true
$ asdf install python 3.7.1
(this succeeds for me)
Thanks, that worked for me as well!
I also am getting similar problems…
❯ asdf install python 3.7.1
python-build 3.7.1 /Users/evan/.asdf/installs/python/3.7.1
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.1.tar.xz...
-> https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
Installing Python-3.7.1...
python-build: use readline from homebrew
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.14 using python-build 1.2.8)
Inspect or clean up the working tree at /var/folders/5_/f2f8clnd4zd7gd6tf7zm4jn00000gn/T/python-build.20181105161823.78561
Results logged to /var/folders/5_/f2f8clnd4zd7gd6tf7zm4jn00000gn/T/python-build.20181105161823.78561.log
Last 10 log lines:
install|*) ensurepip="" ;; \
esac; \
./python.exe -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Looking in links: /var/folders/5_/f2f8clnd4zd7gd6tf7zm4jn00000gn/T/tmp0ib4qurm
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1
@evantravers Try installing openssl from homebrew using brew install openssl
. Might do the trick.
Using mac os 10.14 Mojave
Not sure what fixed this for me, but I ran these things in this order:
$ asdf install python 3.7.1
# FAIL: "Missing the zlib?"
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
$ asdf install python 3.7.1
# FAIL: "Missing the OpenSSL lib?"
$ brew install -s python
# FAIL: "Please reinstall readline. Sorry :("
$ brew reinstall readline
$ brew install -s python
# SUCCESS
$ brew uninstall python
$ asdf install python 3.7.1
# SUCCESS
When you install zlib
from Homebrew it gives you a hint:
% brew install zlib
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.
==> Downloading https://homebrew.bintray.com/bottles/zlib-1.2.11.mojave.bottle.tar.gz
Already downloaded: /Users/jamil/Library/Caches/Homebrew/downloads/01ac92cf18f86708cd068eaf9a3594a15b31861eca1e4d6718563d5e27acd6b2--zlib-1.2.11.mojave.bottle.tar.gz
==> Pouring zlib-1.2.11.mojave.bottle.tar.gz
==> Caveats
zlib is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find zlib you may need to set:
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
==> Summary
🍺 /usr/local/Cellar/zlib/1.2.11: 12 files, 373KB
So on my Mac with 10.14.1 I just needed the following:
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
asdf install python 3.6.7
I was having the SSL issue even after trying brew reinstall readline
and other suggestions and brew reinstall -s python
solved it, even without brew uninstall python
. Not sure if -s
was really required or not.
Noticed that brew install python
also installs pkg-config
so maybe this package is related to the issue? It is a little weird having to install Homebrew's python to be able to install asdf's python.
I too am having issues and hoping someone sees the error in my ways.
asdf install python 3.6.8 1247ms Fri Jan 4 10:53:13 2019
python-build 3.6.8 /Users/paulthomas/.asdf/installs/python/3.6.8
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.8.tar.xz...
-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
Installing Python-3.6.8...
python-build: use readline from homebrew
BUILD FAILED (OS X 10.14.2 using python-build 1.2.8-12-g775a4b63)
Inspect or clean up the working tree at /var/folders/lf/zzyy185j7bzd9c540qp_46ww0000gp/T/python-build.20190104105327.83497
Results logged to /var/folders/lf/zzyy185j7bzd9c540qp_46ww0000gp/T/python-build.20190104105327.83497.log
Last 10 log lines:
_test_repeated_init_and_subinterpreters in _testembed.o
"_Py_SetProgramName", referenced from:
_test_forced_io_encoding in _testembed.o
_test_repeated_init_and_subinterpreters in _testembed.o
_test_pre_initialization_api in _testembed.o
"_Py_SetStandardStreamEncoding", referenced from:
_test_forced_io_encoding in _testembed.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
Below are the steps that I've done I've set the build flags as defined above for LDFLAGS, CPPFLAGS, PKG_CONFIG_PATH, & KEEP_BUILD_PATH Reinstalled zlib (brew reinstall zlib) Reinstalled pythong (brew reinstall -s python) Ran brew doctor and fixed findutils
I'm still getting the same error.
I can download the tarball from python's website and successfully compile it. I didn't install.
Same issue under Mojave 10.14.2 when install Python 3.7.2. Tinkered with adding openssl/zlib via homebrew and various compiler flags but it wasn't enough. I eventually gave up and installed Python via homebrew instead of asdf.
asdf-python is simply wrapping pyenv's python-build. For build errors, please check pyenv issue tracker. If it works with python-build but not with asdf-python please open another issue or comment here.
@danhper The fix everyone is using for python-build
is to export LDFLAGS and CPPFLAGS env vars to point to zlib installed with Homebrew, and re-run the Python install. However, running this plugin, it seems that these env vars are ignored - it always uses the zlib from xcode:
python-build: use zlib from xcode sdk
This seems like it's in your court to fix. asdf-python
won't work on a brand-new Mac laptop. Will you help us out, or just point the finger elsewhere?
Here is the solution that worked for me:
https://github.com/pyenv/pyenv/issues/1737#issuecomment-765724815
So it's possible to add the flag to asdf also:
CFLAGS=-Wno-implicit-function-declaration asdf install python 3.6.0
I tried installing both 3.7.1 and 3.6.7 with the same result shown below. It seems Mojave may have removed zlib: https://stackoverflow.com/questions/48288658/zipimport-zipimporterror-cant-decompress-data-zlib-not-available#comment92859734_50370494.