aws-elastic-beanstalk-cli-setup icon indicating copy to clipboard operation
aws-elastic-beanstalk-cli-setup copied to clipboard

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

Open KeisukeFujioka opened this issue 5 years ago • 22 comments

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.

KeisukeFujioka avatar Aug 10 '19 07:08 KeisukeFujioka

@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.

ChaseAllbee avatar Aug 12 '19 21:08 ChaseAllbee

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.

allenbkim avatar Aug 14 '19 05:08 allenbkim

@ChaseAllbee @allenbkim Thank you for answering. I will try these solution. I will tell result.

KeisukeFujioka avatar Aug 18 '19 15:08 KeisukeFujioka

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

OnlyJoe33 avatar Aug 19 '19 07:08 OnlyJoe33

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

cbodtorf avatar Dec 09 '19 15:12 cbodtorf

Using pyenv directly to install python 3.7.2 worked for me

Dartv avatar Dec 26 '19 12:12 Dartv

I have the same issue as @KeisukeFujioka

I already tried setting the CFLAGS and LDFLAGS as suggested but same results.

joben avatar Jan 08 '20 14:01 joben

I have the same problem and i have Ubuntu

coffemanfp avatar Jan 12 '20 14:01 coffemanfp

@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!

ariestav avatar Jan 29 '20 20:01 ariestav

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

ressom avatar Jan 29 '20 22:01 ressom

Thank you @ressom. That worked for me.

fernandosouza avatar Mar 07 '20 23:03 fernandosouza

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

David2913 avatar Mar 18 '20 04:03 David2913

Hi. I am having the same issue and have tried everything discussed above. My system Python is 3.7.6. Any ideas please? Thanks

============================================== I. Installing Python


  1. Determining whether pyenv is already installed and in PATH

- pyenv found in PATH. Won't clone pyenv git repository from GitHub

  1. Temporarily export necessary pyenv paths


  1. Checking whether Python can be downloaded (through curl, wget, or aria2c)


  1. Installing Python 3.7.2. This step may take a few minutes

python-build: use [email protected] 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 python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/tb/6sqdmsz567q74dwm5gzkbw4h0000gn/T/python-build.20200320124029.99458 Results logged to /var/folders/tb/6sqdmsz567q74dwm5gzkbw4h0000gn/T/python-build.20200320124029.99458.log

Last 10 log lines: checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... checking for --without-gcc... no checking for --with-icc... no checking for gcc... x86_64-apple-darwin13.4.0-clang checking whether the C compiler works... no configure: error: in /var/folders/tb/6sqdmsz567q74dwm5gzkbw4h0000gn/T/python-build.20200320124029.99458/Python-3.7.2': configure: error: C compiler cannot create executables See config.log' for more details make: *** No targets specified and no makefile found. Stop. Exiting due to failure

VG2000 avatar Mar 20 '20 12:03 VG2000

I have the exact same issue.

minhng22 avatar Mar 27 '20 14:03 minhng22

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

ohaponiuk avatar Apr 22 '20 19:04 ohaponiuk

Hi All, appreciate your advice, I am trying to install python 3.6.8 via pyenv and I came across this error. `

`(base) ➜ ~ pyenv doctor Cloning /Users/kwekwl/.pyenv/plugins/pyenv-doctor/bin/..... Installing python-pyenv-doctor... python-build: use readline from homebrew python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424215414.43873 Results logged to /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424215414.43873.log

Last 10 log lines: Cloning into 'python-pyenv-doctor'... warning: --depth is ignored in local clones; use file:// instead. done. /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424215414.43873/python-pyenv-doctor /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424215414.43873 ~ checking for gcc... x86_64-apple-darwin13.4.0-clang checking whether the C compiler works... no configure: error: in /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424215414.43873/python-pyenv-doctor': configure: error: C compiler cannot create executables See config.log' for more details make: *** No targets specified and no makefile found. Stop. Problem(s) detected while checking system.

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

RootieWL avatar Apr 24 '20 13:04 RootieWL

I am having the same issue ✋

Downloading Python-3.7.2.tar.xz... -> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz error: failed to download Python-3.7.2.tar.xz

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

none of the solutions above worked for me

juliopiubello avatar May 04 '20 13:05 juliopiubello

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

Thanks, worked perfectly for me :)

SwetabjaGit avatar May 18 '20 02:05 SwetabjaGit

I had this issue on Mojave 10.14.6, and even though I'd previously installed Xcode Command Line Tools, I downloaded "Command Line Tools for Xcode 11" from developers.apple.com, installed that, and was able to resolve this issue.

boyeatssteak avatar May 23 '20 18:05 boyeatssteak

Using pyenv directly to install python 3.7.2 worked for me

Thanks @Dartv - this was the only solution that worked for me. Once I had installed pyenv manually and then installed python 3.7.2, the rest of the installation went through without issue

blackhaj avatar Aug 22 '20 03:08 blackhaj

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

I have macOS 10.15.7 with default python 2.7 and i run the command above from @ressom and worked for me. Now i have Python 3.7.2 and eb works after the following additions for zsh command line:

~ for python

echo 'export PATH=/Users/<yourUsernameHere>/.pyenv/versions/3.7.2/bin:$PATH' >> /Users/<yourUsernameHere>/.zshrc && source /Users/<yourUsernameHere>/.zshrc

~ for eb

echo 'export PATH="/Users/<yourUsernameHere>/.ebcli-virtual-env/executables:$PATH"' >> ~/.zshenv && source ~/.zshenv

menepet avatar Oct 20 '20 09:10 menepet

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

gonzalo-munillag avatar Jun 19 '21 09:06 gonzalo-munillag