Skip to content

Install fails on OS X (zipimport.ZipImportError: can't decompress data; zlib not available) #41

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

Closed
tomslot opened this issue Jul 22, 2019 · 8 comments
Labels
closing soon if no response OP has not responded to follow-up question in a while; not enough information to proceed.

Comments

@tomslot
Copy link

tomslot commented Jul 22, 2019

Using Mac OS Mojave 10.14.5, bundled_installer fails to install Python with the following errors:

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

Inspect or clean up the working tree at /var/folders/n0/xxh86gld3jb5rxnnp1rtfv4h0000gn/T/python-build.20190722131429.87401
Results logged to /var/folders/n0/xxh86gld3jb5rxnnp1rtfv4h0000gn/T/python-build.20190722131429.87401.log

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

==============================================
II. Creating self-contained EBCLI installation
==============================================
./bundled_installer: line 51: /Users/tomslot/.pyenv/versions/3.7.2/bin/python: No such file or directory
./bundled_installer: line 28: echo_with_indentation: command not found

Suggested workaround (installing zlib and setting CFLAGS) does not work for me.

PS. I also tried to execute:

python3 ebcli_installer.py                      

***********************************
1. Locating virtualenv installation
***********************************
ERROR: Could not find and "virtualenv" installed. Ensurevirtualenv is installed and that it is in PATH before executingthis script.

******************************************
2. Creating exclusive virtualenv for EBCLI
******************************************
/bin/sh: virtualenv: command not found
@rahulrajaram
Copy link
Contributor

Hi @tomslot ,

Suggested workaround (installing zlib and setting CFLAGS) does not work for me.

Are you referring to the workaround here? Was the error the same?

PS. I also tried to execute:

You should be able to get around this particular problem after executing pip install virtualenv.

@rahulrajaram rahulrajaram added the closing soon if no response OP has not responded to follow-up question in a while; not enough information to proceed. label Aug 1, 2019
@Arjun-Aggarwal
Copy link

I am facing the same problem. Tried the suggested workaround but it didn't work

@albertocm
Copy link

Same problem here with the "zipimport.ZipImportError: can't decompress data; zlib not available"...
Any solution to this?

Regards

@drupalji
Copy link

If someone else face this problem, you need to:

export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"

This way zlib will be available.

@BeyersNel
Copy link

The above in isolation did not solve this issue for me. This did though:

sudo rm -r /usr/local/opt/zlib
brew install zlib
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"

Same issue in this thread.

@rahulrajaram
Copy link
Contributor

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.

  1. Find the package location of, say, zlib, inside /Library with a command such as:

     find /Library -name "openssl" 2>/dev/null
    
  2. 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.

@danielinfuse
Copy link

danielinfuse commented Mar 10, 2020

@rahulrajaram you suggested to find a package location of zlib but provided an example of openssl. I find it confusing. Also, doing

find /Library -name "zlib" 2>/dev/null

does not yield any result on MacOS.

@vlad-ko
Copy link

vlad-ko commented Jan 6, 2021

after you try brew install zlib or bzip2, check your /usr/local/opt .. my symlinks were screwed up. zlib was linked to an empty dir. I had to rm -rf zlib and then reinstall it with brew again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon if no response OP has not responded to follow-up question in a while; not enough information to proceed.
Projects
None yet
Development

No branches or pull requests

9 participants