23

I'm using homebrew installing opencv3 on OSX(EI Captain),

brew install opencv3 --with-contrib --with-python3 --HEAD

and an error occurred:

Updating Homebrew...
==> Installing opencv3 from homebrew/science
==> Cloning https://github.com/opencv/opencv.git
Updating /Users/ksun/Library/Caches/Homebrew/opencv3--git
==> Checking out branch master
==> Cloning https://github.com/opencv/opencv_contrib.git
Updating /Users/ksun/Library/Caches/Homebrew/opencv3--contrib--git
> ==> Checking out branch master
Error: No such file or directory - /private/tmp/opencv3-20170330-14255-bxsn05/3rdparty/ippicv/downloader.cmake

Can u guys help me find out how to fix it?

Alex L
  • 8,748
  • 5
  • 49
  • 75
SKSKSKSK
  • 545
  • 1
  • 4
  • 15

4 Answers4

19

I do brew edit opencv3, then comment the following line

inreplace buildpath/"3rdparty/ippicv/downloader.cmake",
  "${OPENCV_ICV_PLATFORM}-${OPENCV_ICV_PACKAGE_HASH}",
  "${OPENCV_ICV_PLATFORM}"

then you can reinstall again with --HEAD

The opencv repository has fix some issue also removed file 3rdparty/ippicv/downloader.cmake, so no need to patch it any more. But they didn't issue a new release, so to install --with-contrib, you have to install with --HEAD, but disable the patch of file 3rdparty/ippicv/downloader.cmake

yjmade
  • 441
  • 4
  • 9
  • This worked for me, but FYI you've got a typo in the code block (`ippicv/ippicv.cmake` should be `ippicv/downloarder.cmake`) – shalott Apr 04 '17 at 14:51
  • what is --HEAD and why do we want it? – user391339 Jan 09 '18 at 05:32
  • 1
    If --HEAD is passed, and formula defines it, install the HEAD version, aka master, trunk, unstable. In this OpenCV case, it download source from github, compile and install – yjmade Jan 10 '18 at 06:16
  • OK I find out about HEAD,. --HEAD : "Rather than compiling a tagged OpenCV release (i.e., v3.0, v3.1, etc.) the --HEAD switch instead clones down the bleeding-edge version of OpenCV from GitHub. Why would we bother doing this? Simple. We need to avoid the QTKit error that plagues macOS Sierra systems with the current tagged OpenCV 3 releases (please see the “Avoiding the QTKit/QTKit.h file not found error” section of this blog post for more information)" – user391339 Mar 05 '18 at 06:34
8

I experienced the same problem. I solved it by running brew install opencv3 --with-contrib --with-python3

I think what happened is that people updated the ../3rdparty/ippicv folder in the repo such that the downloader.cmake file is no longer there, but they have not yet updated the brew formula.

brew install without --HEAD will build opencv3.2.0 which is good enough for me.

wenxi
  • 123
  • 6
4

When I searched for the OpenCV Java issue this was the first result. I am posting my answer for anyone using the OpenCV Java to find it useful, too.

I was following this article: https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html

brew tap homebrew/science 
brew install opencv3 --HEAD --with-contrib --with-java

I tried by removing --HEAD from the above command and I was able to install it sucessfully.

brew install opencv3 --with-contrib --with-java

as per this post: https://github.com/Homebrew/homebrew-science/issues/5498

jmizv
  • 1,172
  • 2
  • 11
  • 28
Siva
  • 1,078
  • 4
  • 18
  • 36
1

I have resolved the issue in the following way:

$ brew edit opencv3

Find the following code block and comment all the 4 lines:

if build.with?("python3") && build.with?("python")
  # Opencv3 Does not support building both Python 2 and 3 versions
  odie "opencv3: Does not support building both Python 2 and 3 wrappers"
end

Finally install using the brew install command:

$ brew install opencv3 --with-contrib --with-python3

Reference: http://www.pyimagesearch.com/2017/05/15/resolving-macos-opencv-homebrew-install-errors/

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Biranchi
  • 16,120
  • 23
  • 124
  • 161