title: Installing pyopencv using pip
body: <p>When I first tried installing pyopencv </p>
  
  <pre><code>./vendor/venv/bin/pip install pyopencv
  </code></pre>
  
  <p>It said there was a problem using CMake. </p>
  
  <p>I built OpenCV on my computer following the instructions <a href="http://tilomitra.com/opencv-on-mac-osx/" rel="nofollow">here</a>. I also used Homebrew to upgrade python and cmake and to install boost. Each step has gotten me a little farther along in the installation process but now I am stuck with this long output...</p>
  
  <pre><code>Installing collected packages: pyopencv
    Running setup.py install for pyopencv
  
  building 'pyopencv.pyopencv_extras' extension
  cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -dynamiclib -I/System/Library/Frameworks/Python.framework/Headers -I/usr/local/include -I/usr/local/include/opencv -I/usr/local/include -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core -I/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv -I/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy -I/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c package/extras/core/ndarray.cpp -o build/temp.macosx-10.8-x86_64-2.7/package/extras/core/ndarray.o -O3 -DNDEBUG
  clang: warning: argument unused during compilation: '-dynamiclib'
  In file included from package/extras/core/ndarray.cpp:16:
  In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15:
  In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
  In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728:
  /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
   ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:58:13: error: redefinition of 'Mat'
  inline Mat::Mat()
              ^
  /usr/local/include/opencv2/core/mat.hpp:67:13: note: previous definition is here
  inline Mat::Mat() : size(&amp;rows)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:59:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0) {}
                                    ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:58:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat()
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:61:13: error: redefinition of 'Mat'
  inline Mat::Mat(int _rows, int _cols, int _type)
              ^
  /usr/local/include/opencv2/core/mat.hpp:72:13: note: previous definition is here
  inline Mat::Mat(int _rows, int _cols, int _type) : size(&amp;rows)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:62:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0)
                                    ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:61:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(int _rows, int _cols, int _type)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:68:13: error: redefinition of 'Mat'
  inline Mat::Mat(int _rows, int _cols, int _type, const Scalar&amp; _s)
              ^
  /usr/local/include/opencv2/core/mat.hpp:78:13: note: previous definition is here
  inline Mat::Mat(int _rows, int _cols, int _type, const Scalar&amp; _s) : size(&amp;rows)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:69:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      : flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
                                    ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:68:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(int _rows, int _cols, int _type, const Scalar&amp; _s)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:79:13: error: redefinition of 'Mat'
  inline Mat::Mat(Size _size, int _type)
              ^
  /usr/local/include/opencv2/core/mat.hpp:85:13: note: previous definition is here
  inline Mat::Mat(Size _sz, int _type) : size(&amp;rows)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:80:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      : flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
                                    ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:79:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(Size _size, int _type)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:87:13: error: redefinition of 'Mat'
  inline Mat::Mat(Size _size, int _type, const Scalar&amp; _s)
              ^
  /usr/local/include/opencv2/core/mat.hpp:91:13: note: previous definition is here
  inline Mat::Mat(Size _sz, int _type, const Scalar&amp; _s) : size(&amp;rows)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:88:31: warning: field 'step' will be initialized after field 'data' [-Wreorder]
  : flags(0), rows(0), cols(0), step(0), data(0), refcount(0),
                                ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:87:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(Size _size, int _type, const Scalar&amp; _s)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:98:13: error: redefinition of 'Mat'
  inline Mat::Mat(const Mat&amp; m)
              ^
  /usr/local/include/opencv2/core/mat.hpp:111:13: note: previous definition is here
  inline Mat::Mat(const Mat&amp; m)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:99:51: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data),
                                                    ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:98:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(const Mat&amp; m)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:106:13: error: redefinition of 'Mat'
  inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
              ^
  /usr/local/include/opencv2/core/mat.hpp:129:13: note: previous definition is here
  inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:108:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      step(_step), data((uchar*)_data), refcount(0),
      ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:106:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:126:13: error: redefinition of 'Mat'
  inline Mat::Mat(Size _size, int _type, void* _data, size_t _step)
              ^
  /usr/local/include/opencv2/core/mat.hpp:151:13: note: previous definition is here
  inline Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
              ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:128:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      step(_step), data((uchar*)_data), refcount(0),
      ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:126:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(Size _size, int _type, void* _data, size_t _step)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:146:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(const Mat&amp; m, const Range&amp; rowRange, const Range&amp; colRange)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:149:10: error: 'operator=' is a protected member of 'cv::Mat::MStep'
      step = m.step; refcount = m.refcount;
      ~~~~ ^ ~~~~~~
  /usr/local/include/opencv2/core/core.hpp:1973:16: note: declared protected here
          MStep&amp; operator = (const MStep&amp;);
                 ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:182:5: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      step(m.step), data(m.data + roi.y*step), refcount(m.refcount),
      ^
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:180:13: error: constructor for 'cv::Mat' must explicitly initialize the member 'size' which does not have a default constructor
  inline Mat::Mat(const Mat&amp; m, const Rect&amp; roi)
              ^
  /usr/local/include/opencv2/core/core.hpp:1976:11: note: member is declared here
      MSize size;
            ^
  /usr/local/include/opencv2/core/core.hpp:1948:23: note: 'cv::Mat::MSize' declared here
      struct CV_EXPORTS MSize
                        ^
  In file included from package/extras/core/ndarray.cpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/ndarray.hpp:18:
  In file included from /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/core/opencv_headers.hpp:9:
  /Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/package/extras/sdopencv/sdcxmat.hpp:197:35: warning: field 'step' will be initialized after field 'data' [-Wreorder]
      rows(m-&gt;rows), cols(m-&gt;cols), step(m-&gt;step), data(m-&gt;data.ptr), refcount(0),
                                    ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  11 warnings and 20 errors generated.
  error: command 'cc' failed with exit status 1
  Complete output from command /Users/andrewcopp/Developer/backend/vendor/venv/bin/python -c "import setuptools;__file__='/Users/andrewcopp/Developer/backend/vendor/venv/build/pyopencv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/00/v2cptx497wb4bwpl5fc3w8yc0000gn/T/pip-pW3TZf-record/install-record.txt --single-version-externally-managed --install-headers /Users/andrewcopp/Developer/backend/vendor/venv/bin/../include/site/python2.7:
  </code></pre>
  
  <p>...</p>
  
  <p>The output then goes in to more detail but StackOverflow is limiting the size of my post.</p>
  
  <p>For what it's worth, I have many other packages installed in this virtualenv including pillow and numpy.</p>