This repository has been archived by the owner. It is now read-only.

OpenCV install fails on MacOS Sierra (10.12) at 16% #4303

Closed
barronlroth opened this Issue Sep 13, 2016 · 32 comments

Comments

Projects
None yet
@barronlroth

Indicate troubleshooting steps taken

  • [ YES ] Ran brew update and retried your prior step?
  • [ YES ] Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • [ YES ] Checked that a similar issue hasn't already been filed?
  • [ YES ] Looked up the software bug tracker if reporting a build error?
  • [ YES ] If you're seeing permission errors tried running sudo chown -R $(whoami) $(brew --prefix)?

Bug reports / build errors:

Brief summary of issue:

OpenCV installation fails at [ 16%] Built target opencv_video

The complete command that you issued:

brew install opencv

Gist with output of brew doctor:

In Gist below

Link output by brew gist-logs <formula>:

https://gist.github.com/barronlroth/2860981929c4ebbdb2dffbd1f72bbebd

Output of brew config:

In gist above^

Formula Requests:

The quickest way to get a new formula into Homebrew is to file a Pull Request.

We will consider your request but it may be closed if it's something we're not actively planning to work on.

@dpo

This comment has been minimized.

Show comment
Hide comment
@dpo

dpo Sep 13, 2016

Contributor

For reference, the error is

cd /tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild/modules/video && /usr/local/Library/Homebrew/shims/super/clang++   -DCVAPI_EXPORTS -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/perf -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/calib3d/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/features2d/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/highgui/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/imgproc/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/flann/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/core/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/ts/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild/modules/video -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/src -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/test -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild -isystem /usr/local/include/eigen3  -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -DNDEBUG  -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fPIC   -o CMakeFiles/opencv_video.dir/src/kalman.cpp.o -c /tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/src/kalman.cpp
/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/highgui/src/cap_qtkit.mm:46:9: fatal error: 'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
        ^
Contributor

dpo commented Sep 13, 2016

For reference, the error is

cd /tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild/modules/video && /usr/local/Library/Homebrew/shims/super/clang++   -DCVAPI_EXPORTS -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/perf -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/calib3d/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/features2d/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/highgui/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/imgproc/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/flann/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/core/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/ts/include -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild/modules/video -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/src -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/test -I/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/macbuild -isystem /usr/local/include/eigen3  -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -DNDEBUG  -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fPIC   -o CMakeFiles/opencv_video.dir/src/kalman.cpp.o -c /tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/video/src/kalman.cpp
/tmp/opencv-20160913-71239-42tmik/opencv-2.4.13/modules/highgui/src/cap_qtkit.mm:46:9: fatal error: 'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
        ^
@barronlroth

This comment has been minimized.

Show comment
Hide comment
@barronlroth

barronlroth Sep 14, 2016

@dpo Good call. Any tips on finding QTKit/QTKit.h?

Update: Same issue as this it seems. I guess we're still waiting for a fix for Sierra in general.

barronlroth commented Sep 14, 2016

@dpo Good call. Any tips on finding QTKit/QTKit.h?

Update: Same issue as this it seems. I guess we're still waiting for a fix for Sierra in general.

@Noctem

This comment has been minimized.

Show comment
Hide comment
@Noctem

Noctem Sep 15, 2016

The problem also occurs on non-Sierra systems with Xcode 8.

Noctem commented Sep 15, 2016

The problem also occurs on non-Sierra systems with Xcode 8.

@barronlroth

This comment has been minimized.

Show comment
Hide comment
@barronlroth

barronlroth Sep 15, 2016

@Noctem And Homebrew doctor forces Xcode 8 when running Sierra.

@Noctem And Homebrew doctor forces Xcode 8 when running Sierra.

@barronlroth barronlroth referenced this issue in opencv/opencv Sep 15, 2016

Merged

AVFoundation support for macOS #7159

@heinemml

This comment has been minimized.

Show comment
Hide comment
@heinemml

heinemml Sep 15, 2016

Contributor

What @Noctem means: this also now breaks on El Capitan with the Release of XCode 8. Which is more or less an automatic update.

Contributor

heinemml commented Sep 15, 2016

What @Noctem means: this also now breaks on El Capitan with the Release of XCode 8. Which is more or less an automatic update.

@dpo

This comment has been minimized.

Show comment
Hide comment
@dpo

dpo Sep 16, 2016

Contributor

This is more or less a duplicate of #4104. See also opencv/opencv#7159.

Contributor

dpo commented Sep 16, 2016

This is more or less a duplicate of #4104. See also opencv/opencv#7159.

@sromberg

This comment has been minimized.

Show comment
Hide comment
@sromberg

sromberg Sep 17, 2016

Confirmed for 10.11 on XCode 8:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G1004

$ clang++ -v
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Compile error at:

/tmp/opencv-20160917-26901-4448l6/opencv-2.4.13/modules/highgui/src/cap_qtkit.mm:46:9: fatal error: 'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
        ^
1 error generated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1

Confirmed for 10.11 on XCode 8:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G1004

$ clang++ -v
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Compile error at:

/tmp/opencv-20160917-26901-4448l6/opencv-2.4.13/modules/highgui/src/cap_qtkit.mm:46:9: fatal error: 'QTKit/QTKit.h' file not found
#import <QTKit/QTKit.h>
        ^
1 error generated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1

@popoko2 popoko2 referenced this issue Sep 19, 2016

Closed

opencv3 failed to build on 10.11.6 #4320

0 of 1 task complete
@zo7

This comment has been minimized.

Show comment
Hide comment
@zo7

zo7 Sep 19, 2016

In case anyone's wondering, you can download an older version of Xcode and choose it with xcode-select and OpenCV will build correctly (10.11)

zo7 commented Sep 19, 2016

In case anyone's wondering, you can download an older version of Xcode and choose it with xcode-select and OpenCV will build correctly (10.11)

@iMicknl

This comment has been minimized.

Show comment
Hide comment
@iMicknl

iMicknl Sep 19, 2016

@zo7 unfortunately this doesn't work on 10.12. I am trying to run it with Xcode 7.3, but still the same error at 16%.
(but I see OpenCV 3 is fixed and the fix will be backported to 2.4)

iMicknl commented Sep 19, 2016

@zo7 unfortunately this doesn't work on 10.12. I am trying to run it with Xcode 7.3, but still the same error at 16%.
(but I see OpenCV 3 is fixed and the fix will be backported to 2.4)

@JCount JCount referenced this issue Sep 23, 2016

Closed

opencv 2.4.13.1 #4336

7 of 8 tasks complete
@vinyldarkscratch

This comment has been minimized.

Show comment
Hide comment
@vinyldarkscratch

vinyldarkscratch Sep 28, 2016

The problem is that QTKit is deprecated since 10.9, and it was stated that it will be removed in a future version. It seems that Sierra is that very version. AVFoundation is the library they say should be used in it's place.

The problem is that QTKit is deprecated since 10.9, and it was stated that it will be removed in a future version. It seems that Sierra is that very version. AVFoundation is the library they say should be used in it's place.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Sep 30, 2016

Same problem: "fatal error: 'QTKit/QTKit.h' file not found"

ghost commented Sep 30, 2016

Same problem: "fatal error: 'QTKit/QTKit.h' file not found"

@barronlroth

This comment has been minimized.

Show comment
Hide comment
@barronlroth

barronlroth Oct 4, 2016

@xanview installing the --HEAD version should work.

@xanview installing the --HEAD version should work.

@yujun1214

This comment has been minimized.

Show comment
Hide comment
@yujun1214

yujun1214 Oct 5, 2016

I met the same problem, was it fixed?

I met the same problem, was it fixed?

@chriswl chriswl referenced this issue Oct 7, 2016

Closed

Fail to install OpenCV #4416

5 of 5 tasks complete
@mhulse

This comment has been minimized.

Show comment
Hide comment
@mhulse

mhulse Oct 8, 2016

@xanview installing the --HEAD version should work.

So, like: brew tap homebrew/science && brew install --HEAD opencv3? :)

mhulse commented Oct 8, 2016

@xanview installing the --HEAD version should work.

So, like: brew tap homebrew/science && brew install --HEAD opencv3? :)

@ablyeom

This comment has been minimized.

Show comment
Hide comment
@ablyeom

ablyeom Oct 9, 2016

@mhulse
maybe right. brew install --HEAD opencv3

ablyeom commented Oct 9, 2016

@mhulse
maybe right. brew install --HEAD opencv3

@mhulse

This comment has been minimized.

Show comment
Hide comment
@mhulse

mhulse Oct 9, 2016

Thanks for the reply @ablyeom. Do you happen to know if I need to add anything to my path after install? When I run which opencv3 or which opencv, I get nothing. :(

mhulse commented Oct 9, 2016

Thanks for the reply @ablyeom. Do you happen to know if I need to add anything to my path after install? When I run which opencv3 or which opencv, I get nothing. :(

@ablyeom

This comment has been minimized.

Show comment
Hide comment
@ablyeom

ablyeom Oct 9, 2016

@mhulse
OpenCV(which you installed) is not executable file. it's a library for computer vision.

In my case, lib and include directories are located under /usr/local/Cellar/opencv3/HEAD-dd379ec_4 directory.

And! I am starter of opencv, actually... so I cannot help you properly.T-T

ablyeom commented Oct 9, 2016

@mhulse
OpenCV(which you installed) is not executable file. it's a library for computer vision.

In my case, lib and include directories are located under /usr/local/Cellar/opencv3/HEAD-dd379ec_4 directory.

And! I am starter of opencv, actually... so I cannot help you properly.T-T

@mhulse

This comment has been minimized.

Show comment
Hide comment
@mhulse

mhulse Oct 9, 2016

Thanks @ablyeom, I really appreciate it! 👍 I'm new to opencv too. I just assumed it would show up on my path after installation. I'm trying to use it in conjunction with a node package … Anyway, starter here too! Thanks again!

mhulse commented Oct 9, 2016

Thanks @ablyeom, I really appreciate it! 👍 I'm new to opencv too. I just assumed it would show up on my path after installation. I'm trying to use it in conjunction with a node package … Anyway, starter here too! Thanks again!

@YangxintongLyu

This comment has been minimized.

Show comment
Hide comment
@YangxintongLyu

YangxintongLyu Oct 11, 2016

@ablyeom that works. Thanks a lot!

@ablyeom that works. Thanks a lot!

@ablyeom

This comment has been minimized.

Show comment
Hide comment
@ablyeom

ablyeom Oct 13, 2016

@lv1204 I am glad to be of help :)

I found option to install with new numpy-1.11.2, instead of dependency numpy-1.11.1.
If you want to use python, append --without-numpy option.
To use this option, you should install numpy using brew or pip.

ablyeom commented Oct 13, 2016

@lv1204 I am glad to be of help :)

I found option to install with new numpy-1.11.2, instead of dependency numpy-1.11.1.
If you want to use python, append --without-numpy option.
To use this option, you should install numpy using brew or pip.

@kosma kosma referenced this issue Oct 15, 2016

Closed

aruco 2.0.14 (new formula) #4456

5 of 9 tasks complete
@deshengxu

This comment has been minimized.

Show comment
Hide comment
@deshengxu

deshengxu Oct 16, 2016

I downloaded latest code from OpenCV and it seems like they replaced qtkit.h with AVFoundation. if I compile with XCode, now it can pass 16% and move on. However, it seems like brew is still using old code and therefore it continues fail.
sadly I have uninstalled old version installed by brew and now I can't come back.

I downloaded latest code from OpenCV and it seems like they replaced qtkit.h with AVFoundation. if I compile with XCode, now it can pass 16% and move on. However, it seems like brew is still using old code and therefore it continues fail.
sadly I have uninstalled old version installed by brew and now I can't come back.

@kosma

This comment has been minimized.

Show comment
Hide comment
@kosma

kosma Oct 17, 2016

downloaded latest code from OpenCV and it seems like they replaced qtkit.h with AVFoundation. if I compile with XCode, now it can pass 16% and move on. However, it seems like brew is still using old code and therefore it continues fail.
sadly I have uninstalled old version installed by brew and now I can't come back.

@xudesheng Use brew install opencv --HEAD as a workaround.

kosma commented Oct 17, 2016

downloaded latest code from OpenCV and it seems like they replaced qtkit.h with AVFoundation. if I compile with XCode, now it can pass 16% and move on. However, it seems like brew is still using old code and therefore it continues fail.
sadly I have uninstalled old version installed by brew and now I can't come back.

@xudesheng Use brew install opencv --HEAD as a workaround.

@dpo

This comment has been minimized.

Show comment
Hide comment
@dpo

dpo Oct 19, 2016

Contributor

Fixed by #4336.

Contributor

dpo commented Oct 19, 2016

Fixed by #4336.

@Walid-Ahmed

This comment has been minimized.

Show comment
Hide comment
@Walid-Ahmed

Walid-Ahmed Oct 25, 2016

I installed without errors using
brew install opencv3 --HEAD

still I can not import CV2 and get the error "ImportError: No module named cv2"

Walid-Ahmed commented Oct 25, 2016

I installed without errors using
brew install opencv3 --HEAD

still I can not import CV2 and get the error "ImportError: No module named cv2"

@yongduek

This comment has been minimized.

Show comment
Hide comment
@yongduek

yongduek Oct 27, 2016

After removing all the opencv versions, I installed without errors using
brew install opencv3 --HEAD
and
brew link --force opencv3 --HEAD --overwrite

No problem to compile and run an example in samples/cpp.

After removing all the opencv versions, I installed without errors using
brew install opencv3 --HEAD
and
brew link --force opencv3 --HEAD --overwrite

No problem to compile and run an example in samples/cpp.

@Eitot Eitot referenced this issue in Homebrew/homebrew-core Oct 30, 2016

Closed

Formulae without Sierra bottles #6408

154 of 157 tasks complete
@codermw

This comment has been minimized.

Show comment
Hide comment
@codermw

codermw Nov 5, 2016

I installed without errors using brew install opencv3 --HEAD and brew link --force opencv3 --HEAD --overwrite but I still can't import CV2 and get the error "ImportError: No module named cv2".
I can see the cv2.so file in /usr/local/opt/opencv3/lib/python2.7/site-packages, and the cvopen3.pth is in /usr/local/lib/python2.7/site-packages/ but it still doesn't seem to be linking properly.... any ideas on how to fix this?

codermw commented Nov 5, 2016

I installed without errors using brew install opencv3 --HEAD and brew link --force opencv3 --HEAD --overwrite but I still can't import CV2 and get the error "ImportError: No module named cv2".
I can see the cv2.so file in /usr/local/opt/opencv3/lib/python2.7/site-packages, and the cvopen3.pth is in /usr/local/lib/python2.7/site-packages/ but it still doesn't seem to be linking properly.... any ideas on how to fix this?

@ghattab

This comment has been minimized.

Show comment
Hide comment
@ghattab

ghattab Nov 17, 2016

@yongduek's solution works!

>>> cv2.__version__
'3.1.0-dev'

ghattab commented Nov 17, 2016

@yongduek's solution works!

>>> cv2.__version__
'3.1.0-dev'
@NilanjPatel

This comment has been minimized.

Show comment
Hide comment
@NilanjPatel

NilanjPatel Nov 20, 2016

@codermw @Walid-Ahmed have you solved your issue of importing error for cv3, if you have solution than please guide me

@codermw @Walid-Ahmed have you solved your issue of importing error for cv3, if you have solution than please guide me

@Mauker1 Mauker1 referenced this issue Dec 6, 2016

Closed

opencv lopencv_imgcodecs not found #4680

5 of 5 tasks complete
@YuBPan

This comment has been minimized.

Show comment
Hide comment
@YuBPan

YuBPan Dec 15, 2016

add this to your ~/.bashrc

export PYTHONPATH=$PATHONPATH:/usr/local/Cellar/opencv3/HEAD-7d5fd6a_4/lib/python2.7/site-packages/

then source ~/.bashrc, now

python -c "import cv2;  print cv2.__version__"
3.1.0-dev

same for ~/.zshrc if you use zsh instead of bash

YuBPan commented Dec 15, 2016

add this to your ~/.bashrc

export PYTHONPATH=$PATHONPATH:/usr/local/Cellar/opencv3/HEAD-7d5fd6a_4/lib/python2.7/site-packages/

then source ~/.bashrc, now

python -c "import cv2;  print cv2.__version__"
3.1.0-dev

same for ~/.zshrc if you use zsh instead of bash

@wumengfei

This comment has been minimized.

Show comment
Hide comment
@wumengfei

wumengfei Dec 29, 2016

it gives me a hint

To install it, run:
  brew install homebrew/science/opencv3

it gives me a hint

To install it, run:
  brew install homebrew/science/opencv3
@Ling-wei

This comment has been minimized.

Show comment
Hide comment
@Ling-wei

Ling-wei Mar 25, 2017

Anybody here...I updated my macOS to 10.12 last month ,before that I had already install opencv 3 successfully...For some reason,I need to intall opencv 2.4.9 with xcode 8....When I made the file, I met the same question. I tried everything to fix the problem about 'QTKit/QTKit.h', but the process is still stuck at 31% with a fatal error.HELP!!!!!("brew install opencv3 --HEAD" doesn't work for me..)

Anybody here...I updated my macOS to 10.12 last month ,before that I had already install opencv 3 successfully...For some reason,I need to intall opencv 2.4.9 with xcode 8....When I made the file, I met the same question. I tried everything to fix the problem about 'QTKit/QTKit.h', but the process is still stuck at 31% with a fatal error.HELP!!!!!("brew install opencv3 --HEAD" doesn't work for me..)

@iMichka

This comment has been minimized.

Show comment
Hide comment
@iMichka

iMichka Mar 26, 2017

Contributor

Please don't post on old closed issues, and open a new issue (and fill out the issue template).

Contributor

iMichka commented Mar 26, 2017

Please don't post on old closed issues, and open a new issue (and fill out the issue template).

@MathGrelck MathGrelck referenced this issue in menpo/conda-opencv3 Aug 10, 2017

Closed

build error in macOS Sierra #31

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.