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 and python@2 can build on Mac 10.14, but zlib is not found, which breaks pip #29176

jnozsc opened this issue Jun 18, 2018 · 10 comments


Copy link

@jnozsc jnozsc commented Jun 18, 2018

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse:
  • have a problem with brew install (or upgrade, reinstall) a single, official formula (not cask)? If it's a general brew problem please file this issue at Homebrew/brew: If it's a brew cask problem please file this issue at If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)
    I do brew upgrade today, and python@2 and python, which previously install on Mac 10.13, get updated and build with 10.14 environment

  • What happened (include command output)
    After the install finish without any error,
    when I run python or python3, it still works
    but when I run pip or pip3, I get the following error message

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 2700, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 2318, in load
    return self.resolve()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/", line 20, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/", line 8, in <module>
    from .connectionpool import (
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/", line 36, in <module>
    from .response import HTTPResponse
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/", line 3, in <module>
    import zlib
ModuleNotFoundError: No module named 'zlib'
  • What you expected to happen
    pip and pip3 should work

  • Step-by-step reproduction instructions (by running brew install commands)
    here is my brew gist-logs python 's output

I assume this maybe related with Homebrew/brew#4335 , but I tried to rebuild either python@2 or pyhon with this branch, still not work

Copy link

@ilovezfs ilovezfs commented Jun 19, 2018

You have the CLT headers installed so I'm not sure how Homebrew/brew#4335 would be relevant.

Copy link

@mistydemeo mistydemeo commented Jun 19, 2018

Hm, I can't reproduce this on the master branch of both Homebrew and homebrew-core.

Was your first test on the latest commit of master for Homebrew and homebrew-core? Is there a file named /usr/include/zlib.h?

Copy link
Contributor Author

@jnozsc jnozsc commented Jun 19, 2018

I tried reinstall everything this morning after upgrade to 10.14 developer preview 2, it seems I can not reproduce this issue either. I think I may mess up my environment before.

Close due to unable to reproduce

@jnozsc jnozsc closed this Jun 19, 2018
Copy link

@sfdye sfdye commented Jun 20, 2018

I have the same issue with zlib not found.

This worked for me:

  1. brew update
  2. (Re)Install CLT. installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
  3. brew reinstall python@2
Copy link

@zedtux zedtux commented Jun 21, 2018

I'm able to reproduce this issue, even with the Beta 2.

If I can help, please let me know what I can do.

Copy link

@zedtux zedtux commented Jun 21, 2018

I followed instructions from @sfdye and python@2 was successfully installed, which also solved my issue from #29245. 🎉

Copy link

@narner narner commented Jun 28, 2018

I'm currently having the same issue - have tried the instructions from @sfdye that @zedtux said they got working. Currently getting the following error after brew reinstall Python@2:

==> Reinstalling python@2 
==> Downloading
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python@2-2.7.15.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python@2/2.7.15_1 --enable-ipv6 --datarootdir=/usr/l
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python@2/2.7.15_1
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python@2/2.7.15_1/share/python@
==> Downloading
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/
==> Downloading
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python@2--pip-10.0.1.tar.gz
==> Downloading
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python@2--wheel-0.31.1.tar.gz
==> make html
Last 15 lines from /Users/nicholasarner/Library/Logs/Homebrew/python@2/05.make:
    return build_main(argv)
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/cmd/", line 22, in build_main
    from sphinx import cmdline
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/", line 23, in <module>
    from sphinx.application import Sphinx
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/", line 29, in <module>
    from sphinx.config import Config
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/", line 21, in <module>
    from sphinx.util import logging
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/", line 33, in <module>
    from sphinx.util import logging
  File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/", line 106, in <module>
    class SphinxLoggerAdapter(logging.LoggerAdapter):
AttributeError: 'module' object has no attribute 'LoggerAdapter'
make: *** [build] Error 1

Do not report this issue to Homebrew/brew or Homebrew/core!

These open issues may also help:
python 3.7.0
python upgrade failing
app-engine-python 1.9.70
molecule: Use correct `docker` python package dependency
[root] formula does not link against python@2 correctly.
clingo add support for lua, use python 3
OSError: [Errno 1] Operation not permitted for python@2 –with-tcl-tk

Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.

Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Copy link

@zedtux zedtux commented Jun 29, 2018

@narner you have a complete different issue than what has been reported in this issue. You should open a new one in my opinion.

Sorry for not being helpful 😞

Copy link

@muammar muammar commented Jun 30, 2018

I am getting the same problem. I upgraded to Mojave beta public preview. Reinstalling python2 as suggested by @sfdye didn't work for me. As pointed out by @mistydemeo, I don't have /usr/include/zlib.h file present on my installation:

muammar@zarathustra ~
  % file /usr/include/zlib.h                                                                                                                           !10161
/usr/include/zlib.h: cannot open `/usr/include/zlib.h' (No such file or directory)

I proceeded to do a brew install zlib and a brew reinstall python and that did not work either.

@ilovezfs ilovezfs mentioned this issue Jul 1, 2018
6 of 6 tasks complete
Copy link

@ruchern-chong ruchern-chong commented Jul 8, 2018

@muammar you might want to try it, since there was an issue with a fix referenced after your comment.

@lock lock bot added the outdated label Aug 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.