aws-elastic-beanstalk-cli-setup: zipimport.ZipImportError: can't decompress data; zlib not available on macOS

Inspect or clean up the working tree at /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380
Results logged to /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380.log

Last 10 log lines:
  File "/private/var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380/Python-3.7.2/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380/Python-3.7.2/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380/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/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190523131052.99380/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

I followed the note but still doesn’t work. I’m using macOS v10.14.4.

> ~/Code  echo $LDFLAGS
-L/usr/local/opt/zlib/lib
> ~/Code  echo $CPPFLAGS
-I/usr/local/opt/zlib/include

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 13
  • Comments: 25 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same issue with installing python from this script. This helped me bypass the issue: brew install pyenv pyenv install 3.7.2

@Rokt33r I also had the zlib error but I was simply able to run brew install awsebcli and it works now (from here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-osx.html)

My solution on Mojave (10.14) is similar to @rahulrajaram , but only link the lib and include folder. For me, the issue is with zlib. You can use the following commands.

brew install zlib

ln -s /usr/local/Cellar/zlib/1.2.11/include/* /usr/local/include

ln -s /usr/local/Cellar/zlib/1.2.11/lib/* /usr/local/lib

I find it easier to just install the pyenv package and install the required python version on my own.

brew install pyenv
pyenv install 3.7.2

Please take note your zlib and python version may vary.

I had the same issue with installing python from this script. This helped me bypass the issue: brew install pyenv pyenv install 3.7.2

Thank you, this solved the issue for me 👍

You get around the Python installation problem by installing Python through other means (e.g. brew install python. Note that usually, OS X comes with a Python 2.7, so you might get away without have to do this). Then:

pip install virtualenv
python ./scripts/ebcli_installer.py

I recommend using the ebcli_installer.py script rather than brew install awsebcli to install the EB CLI precisely for the reasons listed here.

I remove zlib and install it again. Then I’m seeing another error…

**************************
5. Installing Python 3.7.2
**************************
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
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.4 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190524011859.54937
Results logged to /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190524011859.54937.log

Last 10 log lines:
			install|*) ensurepip="" ;; \
		esac; \
		 ./python.exe -E -m ensurepip \
			$ensurepip --root=/ ; \
	fi
Looking in links: /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/tmplhx3ogfr
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-18.1 setuptools-40.6.2
   Exiting due to failure

I had the same issue with installing python from this script. This helped me bypass the issue: brew install pyenv pyenv install 3.7.2

Works for me! thanks!

@Rokt33r , glad that worked.

I’d like to keep this Issue open since, aside from the Open SSL issue, there are minor usability issues that need to be fixed.

pip install virtualenv
python ./scripts/ebcli_installer.py

It works for me! Thanks! 😃