Homebrew-core: Cannot install ansible 2.3.1

Created on 19 Jul 2017  路  12Comments  路  Source: Homebrew/homebrew-core

Please always follow these steps:

  • [x] Confirmed this is a problem with brew installing one, specific formula (not cask) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/Homebrew/caskroom/homebrew-cask/new
  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed all issues and retried your prior step? - unrelated warnings only, no errors
  • [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?

What you were trying to do (and why)

I cannot install or upgrade ansible 2.3.1 on Sierra (10.12.5) after running brew update, brew doctor, and also removing all versions of Ansible and installing fresh. I am trying to install the latest version of Ansible because I use it on a daily basis.

gist-logs are here: https://gist.github.com/2ad8b0c1c89eacfefed6bb9cc6179df4

From investigating, it appears that certain python dependencies that have native libraries (PyYAML, cffi, cryptography, etc) are not building correctly due to being unable to find Python headers. I don't know enough about how Brew handles python or virtualenvs to say more than that.

The installation fails installing PyYAML, and we can indeed see it is due to missing headers (11.pip in the gist):

```clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/ffi -I/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ext/_yaml.c -o build/temp.macosx-10.12-x86_64-2.7/ext/_yaml.o
ext/_yaml.c:4:10: fatal error: 'Python.h' file not found
#include "Python.h"
^
1 error generated.
error: command 'clang' failed with exit status 1
Running setup.py install for PyYAML: finished with status 'error'
Cleaning up...

The (ugly hack) workaround for me, because Ansible is a tool I need to use for my job every day (and I need to test something with 2.3.1 specifically) was forcing C_INCLUDE_PATH to a valid Framework path in the formula install step:

```ruby
  def install
    # https://github.com/Homebrew/homebrew-core/issues/7197                                                                                 
    ENV.prepend "CPPFLAGS", "-I#{MacOS.sdk_path}/usr/include/ffi"
    ENV.prepend "C_INCLUDE_PATH", "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Headers"

After this it installs sucessfully and is usable.

What happened (include command output)

brew install ansible errors out while installing libraries.

What you expected to happen

Ansible is successfully installed.

Step-by-step reproduction instructions (by running brew install commands)

brew install ansible

All 12 comments

I had a similar issue installing vim with homebrew today

@baughj Are you installing with any options or manually requesting a source build? We provide a binary package that I'm unsure why it's not being used for you.

Turned out this happened because I passed in --override-system-vi. When I just did brew install vim It worked fine

@MikeMcQuaid I have HOMEBREW_BUILD_FROM_SOURCE set, not installing with any options.

@baughj please brew update and then try again.

@baughj Additionally: that's not a supported configuration, FYI. It's not a good use of either your or our time to set it.

@mikeMcQuaid that's certainly news to me - and should maybe be reflected at http://docs.brew.sh/FAQ.html . I've had that flag set for a very, very long time.

If it is indeed unsupported, brew doctor should announce that to the user. Then, I would not have wasted anyone's time with the (apparently) unrealistic expectation that compiling software with brew should work.

From the manpage:

              If set, instructs Homebrew to compile from source even when a formula pro-
              vides  a bottle. This environment variable is intended for use by Homebrew
              developers. Please do not file issues if you encounter errors  when  using
              this environment variable.

(apparently) unrealistic expectation that compiling software with brew should work.

Check your tone here, please.

Great, it's in the manpage, so that's at least one place it needs to be indicated.

https://github.com/Homebrew/brew/pull/2919 would add a warning to brew doctor for this case.

Since this is unsupported, I will close this issue and ask that you (or someone who has access to do so) updates the FAQ.

For me upgrading python, as proposed by @pixelhandler in https://github.com/Homebrew/homebrew-core/issues/19110#issuecomment-343710440 was the solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faraazkhan picture faraazkhan  路  3Comments

gregvirgin picture gregvirgin  路  3Comments

bantl23 picture bantl23  路  3Comments

sstadick picture sstadick  路  4Comments

ghost picture ghost  路  3Comments