Homebrew-core: python and python@2 can build on Mac 10.14, but zlib is not found, which breaks pip

Created on 18 Jun 2018  路  10Comments  路  Source: Homebrew/homebrew-core

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.

  • [x] 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: https://discourse.brew.sh
  • [x] 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: https://github.com/Homebrew/brew/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [x] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [x] 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/__init__.py", 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/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/__init__.py", line 20, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/connectionpool.py", line 36, in <module>
    from .response import HTTPResponse
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", 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

https://gist.github.com/jnozsc/afa4e8d3d7e8b827ddc009e482560bb2

I assume this maybe related with https://github.com/Homebrew/brew/pull/4335 , but I tried to rebuild either python@2 or pyhon with this branch, still not work

outdated

Most helpful comment

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

All 10 comments

You have the CLT headers installed so I'm not sure how https://github.com/Homebrew/brew/pull/4335 would be relevant.

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?

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

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

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

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

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

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 https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/[email protected]
==> ./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 https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/[email protected]
==> Downloading https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/[email protected]
==> Downloading https://files.pythonhosted.org/packages/2a/fb/aefe5d5dbc3f4fe1e815bcdb05cbaab19
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/[email protected]
==> 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/build.py", 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/cmdline.py", 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/application.py", 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/config.py", 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/__init__.py", 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/logging.py", 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 https://github.com/Homebrew/homebrew-core/pull/29490
python upgrade failing https://github.com/Homebrew/homebrew-core/issues/29214
app-engine-python 1.9.70 https://github.com/Homebrew/homebrew-core/pull/28858
molecule: Use correct `docker` python package dependency https://github.com/Homebrew/homebrew-core/pull/28635
[root] formula does not link against python@2 correctly. https://github.com/Homebrew/homebrew-core/issues/29377
clingo add support for lua, use python 3 https://github.com/Homebrew/homebrew-core/pull/28057
OSError: [Errno 1] Operation not permitted for python@2 鈥搘ith-tcl-tk https://github.com/Homebrew/homebrew-core/issues/28168

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.

@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 馃槥

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dredmorbius picture dredmorbius  路  3Comments

yuna9 picture yuna9  路  4Comments

jakepetroules picture jakepetroules  路  3Comments

tejasmanohar picture tejasmanohar  路  3Comments

Thirudhas picture Thirudhas  路  4Comments