aws-elastic-beanstalk-cli-setup
aws-elastic-beanstalk-cli-setup copied to clipboard
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
@Rokt33r, try brew install zlib
prior to exporting the flags.
It didn't work for me...:cry:
> brew install zlib
Error: /usr/local/opt/zlib is not a valid keg
I think /usr/local/opt/zlib
might be a broken directory. Try brew unlink zlib
and then retry. Otherwise, you might have to manually remove /usr/local/opt/zlib
.
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
Looks like openssl
is missing as well. Can you retry following a brew install openssl
?
I'm still getting the same error...
It seems like openssl is already installed in my machine. So I ran brew reinstall openssl
again. But nothing is changed.
This is a standard openssl installation problem on OS X. From the looks of it, it sounds like a linkage issue just as it was with zlib. Some openssl issues are discussed here.
Hmm... Do you know where the link should exist? Seems like most of answer is making a link in /usr/local/bin/openssl
. So I've tried but I've kept getting the same error.
> ls /usr/local/bin/openssl
/usr/local/bin/openssl
Should I make the link in other place?
Try:
brew link --force openssl
This should tell you what to link. I see an instruction to export
LDFLAGS
and CPPFLAGS
, but you have to be careful to include not only openssl but also zlib.
I tried but it is not working still...
This should tell you what to link. I see an instruction to export LDFLAGS and CPPFLAGS, but you have to be careful to include not only openssl but also zlib.
How can I include both openssl and zlib?
I set LDFLAGS
and CPPFLAGS
to ~/.zshrc
like below.
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/openssl/include"
And I also executed brew link --force openssl
before running installer script.
Logs
**************************
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.20190531112719.21746
Results logged to /var/folders/n3/ws0911_179dfk_rfxwhq6dvr0000gn/T/python-build.20190531112719.21746.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/tmp494oprmt
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-18.1 setuptools-40.6.2
Exiting due to failure
==============================================
II. Creating self-contained EBCLI installation
==============================================
aws-elastic-beanstalk-cli-setup/scripts/bundled_installer: line 51: /Users/junyoung/.pyenv/versions/3.7.2/bin/python: No such file or directory
aws-elastic-beanstalk-cli-setup/scripts/bundled_installer: line 28: echo_with_indentation: command not found
@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)
@ursulac Thanks. But I think we need to deal with this problem, because this project is supposed to replace brew install awsebcli
. https://github.com/aws/aws-elastic-beanstalk-cli-setup#43-on-macos-or-linux-systems-with-brew-is-this-better-than-brew-install-awsebcli
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.
pip install virtualenv python ./scripts/ebcli_installer.py
It 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.
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
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 👍
I've managed to get past initial error on python by following @anton-syrovatka suggestion.
Now python is throwing
OSError: [Errno 62] Too many levels of symbolic links:
tl;dr: those of you still facing an issue on OS X with zlib/SSL not being found, consider symlinking to the packages installed by brew
from /usr/local
.
One other thing to consider if anybody is still facing the issue on a Macs is that when you brew install
anything, it typically gets put inside /Library/
, whereas a lot of traditional C packages such as CPython expect libraries inside /usr
, /usr/local
,/usr/local/opt
, etc.. This is why when you brew install openssl
, you can a note at the end talking about symlinking.
-
Find the package location of, say, zlib, inside
/Library
with a command such as:find /Library -name "openssl" 2>/dev/null
-
create a symlink to it (note: replace the placeholders
<...>
):sudo ln -s /usr/local/opt/openssl /Library/<path>/openssl<version>
In fact, after this, I don't think you will need to export
LDFLAGS
and CFLAGS
.
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
Works for me! thanks!
@ursulac Thanks. But I think we need to deal with this problem, because this project is supposed to replace
brew install awsebcli
. https://github.com/aws/aws-elastic-beanstalk-cli-setup#43-on-macos-or-linux-systems-with-brew-is-this-better-than-brew-install-awsebcli
I had the same issues that I couldn't fix. But using homebrew actually allowed me to install it in 2 commands. Thank you !
Had same issue and I found this PR #85 which saved my day.
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
You still have to make sure that you have installed openssl readline and zlib with homebrew of course but it was already clearly mentioned.
This PR could be merged to help macOS users.
I was still running into the original issue zipimport.ZipImportError: can't decompress data; zlib not available
on MacOS Catalina 10.15.1. The steps so far didn't really help, and directly running python ebcli_installer.py
lead me into issues with an eb init
error No such file or directory: '/Users/z/.ebcli-virtual-env/bin/eb'
I ended up manually installing python 3.7.3 and setting it as the global python pyenv global 3.7.2
.
This included adding the line eval "$(pyenv init -)"
to my .bash_profile to get it to be properly observed by python -V
.
That solving both the issue with running ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
and eb init
after the fact. Hope this helps!
hey guys, had the same problem, zlip library not being found. But if you cloned with Aws-elastic-beanstalk-cli-setup ( git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git), and run the file Aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py. Ebcli will be installed. But its using EB CLI 3.20.2 (Python 3.9.9), so I am not sure if that will be an issue going forward.