Skip to content
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

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

Open
KeisukeFujioka opened this issue Aug 10, 2019 · 22 comments
Open

Comments

@KeisukeFujioka
Copy link

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.

@ChaseAllbee
Copy link
Contributor

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

@allenbkim
Copy link

allenbkim commented Aug 14, 2019

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
Copy link
Author

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

@OnlyJoe33
Copy link

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

@cbodtorf
Copy link

cbodtorf commented Dec 9, 2019

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

@Dartv
Copy link

Dartv commented Dec 26, 2019

Using pyenv directly to install python 3.7.2 worked for me

@joben
Copy link

joben commented Jan 8, 2020

I have the same issue as @KeisukeFujioka

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

@coffemanfp
Copy link

I have the same problem and i have Ubuntu

@ariestav
Copy link

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

@ressom
Copy link

ressom commented Jan 29, 2020

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

@fernandosouza
Copy link

Thank you @ressom. That worked for me.

@David2913
Copy link

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

@VG2000
Copy link

VG2000 commented Mar 20, 2020

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 openssl@1.1 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

@minhng22
Copy link

I have the exact same issue.

@ohaponiuk
Copy link

ohaponiuk commented Apr 22, 2020

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

@RootieWL
Copy link

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

@juliopiubello
Copy link

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

@SwetabjaGit
Copy link

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 :)

@boyeatssteak
Copy link

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.

@blackhaj
Copy link

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

@menepet
Copy link

menepet commented Oct 20, 2020

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

@gonzalo-munillag
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests