aws-elastic-beanstalk-cli-setup: Python build FAILED (OS X 10.14.6 using python-build 20180424)

Hello. When I install by bundled_installer, bundled_installer fails to install Python with the following error.

************************************************************
5. Installing Python 3.7.2. This step may take a few minutes
************************************************************
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
python-build: use readline from homebrew

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

Inspect or clean up the working tree at /var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076
Results logged to /var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076.log

Last 10 log lines:
  File "/private/var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076/Python-3.7.2/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076/Python-3.7.2/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076/Python-3.7.2/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/rg/jn_7wts95hv3m8dm6g_68t8c0000gn/T/python-build.20190810153428.85076/Python-3.7.2/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
   Exiting due to failure

The following message is output to the logfile.

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                  _gdbm                 _hashlib           
_sqlite3              _ssl                  _uuid              
nis                   ossaudiodev           spwd               
zlib                                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           

Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

I want to know how to install python successfully.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 7
  • Comments: 22 (1 by maintainers)

Most upvoted comments

I think the confusion is in the setting of CFLAGS

If I do the following in a shell, I am able to get things working, but the way the docs express it, it does not work.

From the cloned repo dir:

brew install zlib openssl readline && \
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib" ./scripts/bundled_installer

In case the above solutions did not work for someone, this is what worked for me: After installing using: brew install zlib openssl readline I set an additional flag: CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" The complete command to install the cli was: CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib" CPPFLAGS="-I$(brew --prefix zlib)/include" CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" ./scripts/bundled_installer

@KeisukeFujioka

could you attempt the solution in the docs? Specifically the following:

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

Once you are done trying that then attempt to run the installer again. If you are still having trouble do let me know what error you are running into.

I love how you assume users have installed brew to work with the Elastic Beanstalk CLI scripts. Sorry, it’s bad practice to ask the user to install yet another dependency for troubleshooting. I don’t want to install brew on my machine, and so what do you suggest? I’m running into the same issues as @KeisukeFujioka on macOS Catalina 10.15.2

The logs are so convoluted and now, after failing who knows if my machine is littered with files that are unnecessary. For macOS, just make an installer!

Running the following seems to work for me:

  1. (Re)Install CLT. (copy all the lines) installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
  2. brew update
  3. brew install pyenv

Using pyenv directly to install python 3.7.2 worked for me

Nothing on this thread worked. But I found this, copy in the command line: brew install awsebcli

Omg I tried literally everything written here and on pyenv wiki and it still doesn’t work. I merely need python 3.4.7. I have last version of macOS for now (10.15.4). OpenSSL is definitely installed.

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.4 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/ch/z863354j1rg50dc8gb4f0g1m0000gn/T/python-build.20200422223520.62799
Results logged to /var/folders/ch/z863354j1rg50dc8gb4f0g1m0000gn/T/python-build.20200422223520.62799.log

Last 10 log lines:
(cd /Users/Alexei/.pyenv/versions/3.4.7/share/man/man1; ln -s python3.4.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 9.0.1 requires SSL/TLS

None of these solutions seemed to work for me. Same OSX version as original issue: 10.14.6

I am also on OSX and was receiving this error even though I had zlib installed. I was able to get past this by setting the following:

CPPFLAGS="-I$(brew --prefix zlib)/include"

Careful not to overwrite any other values in CPPFLAGS that are already set.

@KeisukeFujioka

Thanks for contacting us about this issue. In our readme we have a section on troubleshooting. I see you’re using OSX, so could you attempt the solution in the docs? Specifically the following:

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

Once you are done trying that then attempt to run the installer again. If you are still having trouble do let me know what error you are running into.