Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.99k stars 11.36k forks source link

OpenCV not compiling #18590

Closed ssbanerje closed 11 years ago

ssbanerje commented 11 years ago

I am trying to compile OpenCV with the latest version of XCode, Mountain Lion and Homebrew.

I seem to be getting an error in the compilation process.

I am attaching all the logs in this gist

https://gist.github.com/subszero/5197615

adamv commented 11 years ago

If your'e using Java 1.7, this won't compile.

ssbanerje commented 11 years ago

I changed the JAVA_HOME variable like so

export JAVA_HOME=`/usr/libexec/java_home -v 1.6`

But now I am stuck with another error in the compilation. It seems to be getting stuck compiling the Python bindings --

/tmp/opencv-78p9/opencv-2.4.4/modules/python/src2/cv2.cpp:227:9: error: no
      matching function for call to 'PyInt_Check'
    if( PyInt_Check(o) )
        ^~~~~~~~~~~
/usr/local/include/pypy_decl.h:167:17: note: candidate function not viable: 1st
      argument ('const PyObject *' (aka 'const _object *')) would lose const
      qualifier
PyAPI_FUNC(int) PyInt_Check(PyObject *arg0);
                ^
/tmp/opencv-78p9/opencv-2.4.4/modules/python/src2/cv2.cpp:233:9: error: no
      matching function for call to 'PyFloat_Check'
    if( PyFloat_Check(o) )
        ^~~~~~~~~~~~~
......
......
......
/tmp/opencv-78p9/opencv-2.4.4/modules/python/src2/cv2.cpp:814:24: error: use of
      undeclared identifier 'PySequence_Fast_ITEMS'; did you mean
      'PySequence_Fast_GET_SIZE'?
    PyObject** items = PySequence_Fast_ITEMS(seq);
                       ^~~~~~~~~~~~~~~~~~~~~
                       PySequence_Fast_GET_SIZE
/usr/local/include/pypy_decl.h:334:24: note: 'PySequence_Fast_GET_SIZE' declared
      here
PyAPI_FUNC(Py_ssize_t) PySequence_Fast_GET_SIZE(PyObject *arg0);
                       ^
/tmp/opencv-78p9/opencv-2.4.4/modules/python/src2/cv2.cpp:814:16: error: cannot
      initialize a variable of type 'PyObject **' (aka '_object **') with an
      rvalue of type 'Py_ssize_t' (aka 'long')
    PyObject** items = PySequence_Fast_ITEMS(seq);
               ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
10 errors generated.
make[2]: *** [modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
make: *** [all] Error 2

This is a link to the entire file https://gist.github.com/subszero/5197615/raw/d7d02a67c34d1b3f79f8cb00a7dee166d9d07745/makelogwithpyhtonerror

ssbanerje commented 11 years ago

I think I have found what seems to be causing this -

I downloaded OpenCV's latest release (v2.4.4), which homebrew is trying to install; and I tried to compile it myself. The CMake is not able to find libpython.dylib. It is trying to use the system default --

-- Found PythonInterp: /usr/local/bin/python2 (found suitable version "2.7.3", minimum required is "2.0")
-- Could NOT find PythonLibs: Found unsuitable version "2.7.2", but required is exact version "2.7.3" (found /usr/lib/libpython2.7.dylib)

I am using python package available on homebrew. Doesn't this library come along with the python package?

samueljohn commented 11 years ago

That two lines show two different python versions. 2.7.3 (probably the brewed python) and 2.7.2, which is probably from OS X.

If you build OpenCV yourself, you should call ccmake . in the source dir and set-up the python and python lib in that terminal gui. You might need to press c and t or something to first "configure" in cmake and then go to advanced options. I can't remember that correctly.

samueljohn commented 11 years ago

I reproduced you initial error

    [javac] /private/tmp/opencv-wJ9Z/opencv-2.4.4/macbuild/src/org/opencv/core/Core.java:474: error: unmappable character for encoding ASCII

I can fix that by removing the line env :std from the formula. Do you want to test that locally and report back? I am not sure if you need javac bindings and if they are disabled with "superenv" (the build environment homebrew uses if env :std is not present.

samueljohn commented 11 years ago

Also I found that the OpenCV Formula would need some love in terms of what features and libs it needs during build. Homebrew has almost all of them. If no one volunteers, I could put that on my todo list ..

ssbanerje commented 11 years ago

@samueljohn I have python 2.7.3 installed from brew. But I cant find the corresponging libpython.dylib file either in /usr/local/lib or in Cellar folder.

I will try the build removing the env :std

ssbanerje commented 11 years ago

Its working now. But I still have to set the JDK version to 1.6

samueljohn commented 11 years ago

python-config --libs and python-config --ldflags might help...

ssbanerje commented 11 years ago

This is what I get --

~|⇒ python-config --libs
-ldl -framework CoreFoundation -lpython2.7

~|⇒ python-config --ldflags
-L/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7 -u _PyMac_Error Python.framework/Versions/2.7/Python

I guess the problem is that I dont have a libpython.dylib anywhere in this path

~|⇒ tree /usr/local/Cellar/python/2.7.3/ | grep libpython.dylib
~|⇒
samueljohn commented 11 years ago

I have Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib.

ssbanerje commented 11 years ago

I have that file as well. However, OpenCV is not able to find it using cmake. Here is the relevant portion of the cmake output

-- Found PythonInterp: /usr/local/bin/python2 (found suitable version "2.7.3", minimum required is "2.0")
-- Could NOT find PythonLibs: Found unsuitable version "2.7.2", but required is exact version "2.7.3" (found /usr/lib/libpython2.7.dylib)

And this is the summary

--   Python:
--     Interpreter:                 /usr/local/bin/python2 (ver 2.7.3)
--     Libraries:                   /usr/lib/libpython2.7.dylib (ver 2.7.2)
--     numpy:                       /Library/Python/2.7/site-packages/numpy-1.8.0.dev_bbcfcf6_20130307-py2.7-macosx-10.8-intel.egg/numpy/core/include (ver 1.8.0.dev-bbcfcf6)
--     packages path:               lib/python2.7/site-packages
samueljohn commented 11 years ago

I will double check and take care of that. Also the numpy it found is from system python. Big fuck-up ahead.

samueljohn commented 11 years ago

I guess we have to do the same ugly hacks as for vtk.

samueljohn commented 11 years ago

maybe the numpy is not from system python, but it's definitely not in /usr/local/lib/python2.7/site-packages where it would en up being installed for the brewed python.

ssbanerje commented 11 years ago

I am using the numpy version that comes from the homebrew-python tap. https://github.com/samueljohn/homebrew-python/blob/master/numpy.rb

Will that make a difference?

samueljohn commented 11 years ago

That's my tap :-) But with a brewed python, it should end up in /usr/local/lib/python2.7/site-packages/numpy. Strange. Do you have a distribute or setuptools in /Library/Python/2.7/site-packages that takes precedence over the homebrew provided ones?

ssbanerje commented 11 years ago

Not that I know. Is there some way I can check. In terms of my $PATH and $PYTHONPATH... they all point to the brewed version of python

samueljohn commented 11 years ago

Look inside /Library/Python/2.7/site-packages. What is there?

ssbanerje commented 11 years ago

I do have a lot of files in there -

~|⇒ ll /Library/Python/2.7/site-packages
total 8
drwxr-xr-x  23 root  wheel  782 Mar 23 22:08 ./
drwxr-xr-x   3 root  wheel  102 Jun 21  2012 ../
drwxr-xr-x   4 root  wheel  136 Mar 23 22:08 Jinja2-2.6-py2.7.egg/
-rw-r--r--   1 root  wheel  119 Aug  3  2012 README
-rw-r--r--   1 root  wheel  949 Mar 23 22:08 easy-install.pth
drwxr-xr-x   5 root  wheel  170 Mar 23 22:06 ipython-1.0.dev-py2.7.egg/
drwxr-xr-x   7 root  wheel  238 Mar 23 22:06 matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   5 root  wheel  170 Mar 23 22:07 nose-1.2.1-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 numpy-1.8.0.dev_bbcfcf6_20130307-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 pandas-0.11.0.dev_9a6810d_20130307-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:08 patsy-0.1.0-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:08 pika-0.9.12-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Aug 14  2012 pip-1.1-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 pymc-2.2-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   5 root  wheel  170 Mar 23 22:07 pyparsing-1.5.7-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:07 pytz-2013b-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:08 pyzmq-13.0.0-py2.7-macosx-10.6-intel.egg/
drwxr-xr-x   6 root  wheel  204 Mar 23 22:06 readline-6.2.4.1-py2.7-macosx-10.7-intel.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 scikit_learn-0.14_git-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 scipy-0.13.0.dev_c31f167_20130307-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   5 root  wheel  170 Mar 23 22:07 six-1.3.0-py2.7.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:06 statsmodels-0.5.0-py2.7-macosx-10.8-intel.egg/
drwxr-xr-x   4 root  wheel  136 Mar 23 22:07 tornado-2.4.1-py2.7.egg/

And a lot of them repeat in the brewed python's site-packages folder

~|⇒ ll /usr/local/lib/python2.7/site-packages/
total 2216
drwxr-xr-x  112 Subho  admin    3808 Mar 23 22:09 ./
drwxr-xr-x    3 Subho  admin     102 Aug  4  2012 ../
drwxr-xr-x    7 Subho  admin     238 Aug 18  2012 Django-1.4.1-py2.7.egg-info/
drwxr-xr-x    9 Subho  admin     306 Aug 14  2012 Flask-0.9-py2.7.egg-info/
drwxr-xr-x   19 Subho  admin     646 Feb 18 08:28 IPython/
drwxr-xr-x   10 Subho  admin     340 Aug 14  2012 Jinja2-2.6-py2.7.egg-info/
drwxr-xr-x   12 Subho  admin     408 Nov  1 10:43 OpenSSL/
drwxr-xr-x  167 Subho  admin    5678 Nov  1 10:43 PIL/
-rw-r--r--    1 Subho  admin       4 Nov  1 10:43 PIL.pth
drwxr-xr-x   25 Subho  admin     850 Aug 31  2012 PyQt4/
drwxr-xr-x    9 Subho  admin     306 Aug 31  2012 Pygments-1.5-py2.7.egg-info/
drwxr-xr-x   35 Subho  admin    1190 Aug 31  2012 SimPy/
drwxr-xr-x    7 Subho  admin     238 Aug 31  2012 SimPy-2.3.1-py2.7.egg-info/
drwxr-xr-x    4 Subho  admin     136 Mar 23 22:09 SimpleCV-1.3-py2.7.egg/
drwxr-xr-x    8 Subho  admin     272 Aug 14  2012 Werkzeug-0.8.3-py2.7.egg-info/
drwxr-xr-x    6 Subho  admin     204 Aug 18  2012 blessings/
drwxr-xr-x    7 Subho  admin     238 Aug 18  2012 blessings-1.5-py2.7.egg-info/
drwxr-xr-x    7 Subho  admin     238 Aug 18  2012 bottle-0.10.11-py2.7.egg-info/
-rw-r--r--    1 Subho  admin  117295 Aug 18  2012 bottle.py
-rw-r--r--    1 Subho  admin  160900 Aug 18  2012 bottle.pyc
drwxr-xr-x   16 Subho  admin     544 Nov 21 22:31 clint/
drwxr-xr-x    7 Subho  admin     238 Nov 21 22:31 clint-0.3.1-py2.7.egg-info/
-rw-r--r--    1 Subho  admin    8486 Aug 28  2012 clonevirtualenv.py
-rw-r--r--    1 Subho  admin   10642 Aug 28  2012 clonevirtualenv.pyc
drwxr-xr-x   14 Subho  admin     476 Aug 25  2012 colorama/
drwxr-xr-x    7 Subho  admin     238 Aug 25  2012 colorama-0.2.4-py2.7.egg-info/
lrwxr-xr-x    1 Subho  admin      63 Mar 23 14:43 cv.py@ -> ../../../Cellar/opencv/2.4.4a/lib/python2.7/site-packages/cv.py
-r--r--r--    1 Subho  admin     168 Feb  3 12:44 cv.pyc
lrwxr-xr-x    1 Subho  admin      64 Mar 23 14:43 cv2.so@ -> ../../../Cellar/opencv/2.4.4a/lib/python2.7/site-packages/cv2.so
drwxr-xr-x   17 Subho  admin     578 Feb  3 12:24 dateutil/
drwxr-xr-x   10 Subho  admin     340 Aug 14  2012 distribute-0.6.28-py2.7.egg/
drwxr-xr-x   19 Subho  admin     646 Aug 18  2012 django/
-rw-r--r--    1 Subho  admin     240 Mar 23 22:09 easy-install.pth
drwxr-xr-x   42 Subho  admin    1428 Aug 14  2012 flask/
lrwxr-xr-x    1 Subho  admin      91 Feb 15 02:28 fontforge-1.0-py2.7.egg-info@ -> ../../../Cellar/fontforge/20120731/lib/python2.7/site-packages/fontforge-1.0-py2.7.egg-info
lrwxr-xr-x    1 Subho  admin      75 Feb 15 02:28 fontforge.so@ -> ../../../Cellar/fontforge/20120731/lib/python2.7/site-packages/fontforge.so
drwxr-xr-x    7 Subho  admin     238 Mar 14 18:27 git_remote_helpers/
lrwxr-xr-x    1 Subho  admin      93 Mar 14 18:27 git_remote_helpers-0.1.0-py2.7.egg-info@ -> ../../../Cellar/git/1.8.2/lib/python2.7/site-packages/git_remote_helpers-0.1.0-py2.7.egg-info
drwxr-xr-x    7 Subho  admin     238 Sep 12  2012 idlex-1.0-py2.7.egg-info/
drwxr-xr-x   11 Subho  admin     374 Sep 12  2012 idlexlib/
drwxr-xr-x   10 Subho  admin     340 Feb 18 08:28 ipython-0.13.1-py2.7.egg-info/
drwxr-xr-x   49 Subho  admin    1666 Aug 14  2012 jinja2/
drwxr-xr-x   30 Subho  admin    1020 Nov  1 10:43 libmproxy/
lrwxr-xr-x    1 Subho  admin      68 Mar  8 12:06 libvirt.py@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirt.py
-r--r--r--    1 Subho  admin  259221 Aug 14  2012 libvirt.pyc
lrwxr-xr-x    1 Subho  admin      72 Mar  8 12:06 libvirt_lxc.py@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirt_lxc.py
lrwxr-xr-x    1 Subho  admin      73 Mar  8 12:06 libvirt_qemu.py@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirt_qemu.py
lrwxr-xr-x    1 Subho  admin      71 Mar  8 12:06 libvirtmod.so@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirtmod.so
lrwxr-xr-x    1 Subho  admin      75 Mar  8 12:06 libvirtmod_lxc.so@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirtmod_lxc.so
lrwxr-xr-x    1 Subho  admin      76 Mar  8 12:06 libvirtmod_qemu.so@ -> ../../../Cellar/libvirt/1.0.3/lib/python2.7/site-packages/libvirtmod_qemu.so
drwxr-xr-x   27 Subho  admin     918 Nov  1 10:44 lxml/
drwxr-xr-x    8 Subho  admin     272 Nov  1 10:44 lxml-3.0.1-py2.7.egg-info/
drwxr-xr-x  144 Subho  admin    4896 Feb  3 12:24 matplotlib/
lrwxr-xr-x    1 Subho  admin      92 Feb  3 12:24 matplotlib-1.2.0-py2.7.egg-info@ -> ../../../Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/matplotlib-1.2.0-py2.7.egg-info
drwxr-xr-x    8 Subho  admin     272 Nov  1 10:43 mitmproxy-0.8-py2.7.egg-info/
drwxr-xr-x   12 Subho  admin     408 Feb  3 12:24 mpl_toolkits/
drwxr-xr-x   41 Subho  admin    1394 Feb  3 10:16 nose/
drwxr-xr-x    9 Subho  admin     306 Feb  3 10:16 nose-1.2.1-py2.7.egg-info/
drwxr-xr-x   38 Subho  admin    1292 Mar 23 13:53 numpy/
lrwxr-xr-x    1 Subho  admin      82 Mar 23 13:53 numpy-1.7.0-py2.7.egg-info@ -> ../../../Cellar/numpy/1.7.0/lib/python2.7/site-packages/numpy-1.7.0-py2.7.egg-info
drwxr-xr-x   32 Subho  admin    1088 Sep 29 22:38 pip/
drwxr-xr-x    9 Subho  admin     306 Sep 29 22:38 pip-1.2.1-py2.7.egg-info/
lrwxr-xr-x    1 Subho  admin      71 Feb 15 02:28 psMat.so@ -> ../../../Cellar/fontforge/20120731/lib/python2.7/site-packages/psMat.so
drwxr-xr-x    8 Subho  admin     272 Nov  1 10:43 pyOpenSSL-0.13-py2.7.egg-info/
drwxr-xr-x   11 Subho  admin     374 Nov  1 10:43 pyasn1/
drwxr-xr-x    8 Subho  admin     272 Nov  1 10:43 pyasn1-0.1.4-py2.7.egg-info/
drwxr-xr-x   89 Subho  admin    3026 Mar 23 21:57 pygame/
lrwxr-xr-x    1 Subho  admin      98 Mar 23 21:57 pygame-1.9.1release-py2.7.egg-info@ -> ../../../Cellar/pygame/1.9.1release/lib/python2.7/site-packages/pygame-1.9.1release-py2.7.egg-info
drwxr-xr-x   30 Subho  admin    1020 Aug 31  2012 pygments/
lrwxr-xr-x    1 Subho  admin      69 Feb  3 12:24 pylab.py@ -> ../../../Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/pylab.py
lrwxr-xr-x    1 Subho  admin      70 Feb  3 12:24 pylab.pyc@ -> ../../../Cellar/matplotlib/1.2.0/lib/python2.7/site-packages/pylab.pyc
drwxr-xr-x   13 Subho  admin     442 Feb  3 12:24 pytz/
drwxr-xr-x    7 Subho  admin     238 Aug 31  2012 pyzmq-2.2.0.1-py2.7.egg-info/
drwxr-xr-x   40 Subho  admin    1360 Nov 21 22:31 requests/
drwxr-xr-x    7 Subho  admin     238 Nov 21 22:31 requests-0.14.2-py2.7.egg-info/
drwxr-xr-x   38 Subho  admin    1292 Feb  3 12:22 scipy/
lrwxr-xr-x    1 Subho  admin      84 Feb  3 12:21 scipy-0.11.0-py2.7.egg-info@ -> ../../../Cellar/scipy/0.11.0/lib/python2.7/site-packages/scipy-0.11.0-py2.7.egg-info
-rw-r--r--    1 Subho  admin     144 Aug 14  2012 setuptools-0.6c11-py2.7.egg-info
-rw-r--r--    1 Subho  admin      30 Aug 14  2012 setuptools.pth
lrwxr-xr-x    1 Subho  admin      61 Aug 31  2012 sip.so@ -> ../../../Cellar/sip/4.13.3/lib/python2.7/site-packages/sip.so
lrwxr-xr-x    1 Subho  admin      67 Aug 31  2012 sipconfig.py@ -> ../../../Cellar/sip/4.13.3/lib/python2.7/site-packages/sipconfig.py
-r--r--r--    1 Subho  admin   71154 Aug 31  2012 sipconfig.pyc
lrwxr-xr-x    1 Subho  admin      70 Aug 31  2012 sipdistutils.py@ -> ../../../Cellar/sip/4.13.3/lib/python2.7/site-packages/sipdistutils.py
-rw-r--r--    1 Subho  admin    2362 Feb  4 23:03 site.py
-rw-r--r--    1 Subho  admin    1737 Feb  4 23:03 site.pyc
drwxr-xr-x   17 Subho  admin     578 Aug 28  2012 stevedore/
drwxr-xr-x   11 Subho  admin     374 Aug 28  2012 stevedore-0.3-py2.7.egg-info/
drwxr-xr-x   33 Subho  admin    1122 Aug 31  2012 sympy/
drwxr-xr-x    7 Subho  admin     238 Aug 31  2012 sympy-0.7.1-py2.7.egg-info/
drwxr-xr-x   53 Subho  admin    1802 Aug 31  2012 tornado/
drwxr-xr-x    7 Subho  admin     238 Aug 31  2012 tornado-2.3-py2.7.egg-info/
drwxr-xr-x   63 Subho  admin    2142 Nov  1 10:43 urwid/
drwxr-xr-x    8 Subho  admin     272 Nov  1 10:43 urwid-1.1.0-py2.7.egg-info/
drwxr-xr-x    9 Subho  admin     306 Aug 14  2012 virtualenv-1.7.2-py2.7.egg-info/
-rw-r--r--    1 Subho  admin  108233 Aug 14  2012 virtualenv.py
-rw-r--r--    1 Subho  admin   97546 Aug 14  2012 virtualenv.pyc
drwxr-xr-x    8 Subho  admin     272 Aug 28  2012 virtualenv_clone-0.2.4-py2.7.egg-info/
drwxr-xr-x    7 Subho  admin     238 Aug 14  2012 virtualenv_support/
drwxr-xr-x    8 Subho  admin     272 Aug 28  2012 virtualenvwrapper/
-rw-r--r--    1 Subho  admin     340 Aug 28  2012 virtualenvwrapper-3.6-py2.7-nspkg.pth
drwxr-xr-x   11 Subho  admin     374 Aug 28  2012 virtualenvwrapper-3.6-py2.7.egg-info/
drwxr-xr-x    8 Subho  admin     272 Sep 29 17:04 webapp2-2.5.2-py2.7.egg-info/
-rw-r--r--    1 Subho  admin   68371 Sep 29 17:04 webapp2.py
-rw-r--r--    1 Subho  admin   75697 Sep 29 17:04 webapp2.pyc
drwxr-xr-x   35 Subho  admin    1190 Sep 29 17:04 webapp2_extras/
drwxr-xr-x   45 Subho  admin    1530 Aug 14  2012 werkzeug/
drwxr-xr-x    4 Subho  admin     136 Feb  3 12:43 wx-2.9.4-osx_cocoa/
lrwxr-xr-x    1 Subho  admin      64 Feb  3 12:43 wx.pth@ -> ../../../Cellar/wxmac/2.9.4.0/lib/python2.7/site-packages/wx.pth
lrwxr-xr-x    1 Subho  admin      96 Feb  3 12:43 wxPython_common-2.9.4.0-py2.7.egg-info@ -> ../../../Cellar/wxmac/2.9.4.0/lib/python2.7/site-packages/wxPython_common-2.9.4.0-py2.7.egg-info
lrwxr-xr-x    1 Subho  admin      70 Feb  3 12:43 wxversion.py@ -> ../../../Cellar/wxmac/2.9.4.0/lib/python2.7/site-packages/wxversion.py
lrwxr-xr-x    1 Subho  admin      71 Feb  3 12:43 wxversion.pyc@ -> ../../../Cellar/wxmac/2.9.4.0/lib/python2.7/site-packages/wxversion.pyc
drwxr-xr-x   14 Subho  admin     476 Aug 31  2012 zmq/
samueljohn commented 11 years ago

@subszero remove pip-1.1-py2.7.egg/ from /Library/Python/2.7 and then reinstall the stuff in that dir. Then assure your pip installs new stuff into /usr/local/lib/python2.7/site-packages. Also your pip seems outdated. You have several packages in both dirs.

ssbanerje commented 11 years ago

I uninstalled all those packages and reinstalled them into the /usr/local... brewed python. Now, OpenCV picks up another version of numpy I have installed in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

CoreGraphics
OpenSSL
PyObjC
PyObjC.pth
PyRSS2Gen-1.0.0-py2.7.egg-info
PyRSS2Gen.py
PyRSS2Gen.pyc
Twisted-12.0.0-py2.7.egg-info
altgraph
altgraph-0.9-py2.7.egg-info
bdist_mpkg
bdist_mpkg-0.4.4-py2.7.egg-info
bonjour
bonjour_py-0.3-py2.7.egg-info
dateutil
easy_install.py
easy_install.pyc
macholib
macholib-1.4.2-py2.7.egg-info
modulegraph
modulegraph-0.9.1-py2.7.egg-info
numpy
numpy-1.6.1-py2.7.egg-info
pkg_resources.py
pkg_resources.pyc
py2app
py2app-0.6.3-py2.7.egg-info
pyOpenSSL-0.13-py2.7.egg-info
python_dateutil-1.5-py2.7.egg-info
setuptools
setuptools-0.6c12dev_r88846-py2.7.egg-info
site.py
site.pyc
site.pyo
twisted
xattr
xattr-0.6.2-py2.7.egg-info
zope
zope.interface-3.5.1-py2.7.egg-info

Checking the dates on these, they were installed with easy_install from over a year ago. Will it be safe to just rm some of these files?

samueljohn commented 11 years ago

A newer version of Pip than you have is installed by homebrew into /usr/local/bin/pip. (You can safely brew rm python && brew install python if you have a very old python. Your packages in won't be deleted. But you may run into trouble if you have a pip in /usr/local/share/python and/or in the site-packages.)

ssbanerje commented 11 years ago

No I meant can I just delete the files (numpy and numpy-1.6.1-py2.7.egg-info as well as some of the others? Could they have come from easy_install?) from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

They contain some numpy version that I do not remember installing!

samueljohn commented 11 years ago

No, don't ever delete anything from /System - there is Stuff OS X needs. Do delete from /Library/Python/2.7/site-packages because all python's (2.7) import from there, too. So if you (accidently installed stuff with the system python, it may be incompatible with brewed python). If you brew tap samueljohn/python && brew install numpy the numpy should end up in /usr/local/lib/python2.7/site-packages and not somewhere else. But the fact you have stuff in /Library is an indicator that somehow your pip/distribute is not set up correctly to install for the brewed python.

ssbanerje commented 11 years ago

The version of numpy from the tap is ending up there in the brew folder. The version in the /System... folder is something I used to use a long time ago. My $PYTHONPATH is set to the brew folder like so -

dotfiles|master ⇒ echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages:

Then why is OpenCV picking up numpy from the /System... folder? Now that I have this conflict of numpy being installed in both locations... how do I get rid of the /System... one?

samueljohn commented 11 years ago

Well, perhaps openCV hardcodes that? I dunno. Assuming your brew doctor is fine (especially your PATHs are set so that brew comes first), I'd start python and import numpy and then check numpy.version inside python to see which numpy you get.

ssbanerje commented 11 years ago

It picks up 1.6.1, the version installed in /System.... instead of that from the brewed version of numpy (1.7) which is in /usr/local....

It seems to be calling the correct python

~|=> which python
/usr/local/bin/python

But the wring version of numpy

~|=> python
Python 2.7.3 (default, Aug 14 2012, 16:19:11)
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on
darwin
Type "help", "copyright", "credits" or "license" for more information.

Type \e to get an external editor.

>>> import numpy.version as v
>>> v.version
'1.6.1'
>>>

On Tue, Mar 26, 2013 at 12:03 PM, Samuel John notifications@github.comwrote:

Well, perhaps openCV hardcodes that? I dunno. Assuming your brew doctor is fine (especially your PATHs are set so that brew comes first), I'd start python and import numpy and then check numpy.version inside python to see which numpy you get.

Reply to this email directly or view it on GitHubhttps://github.com/mxcl/homebrew/issues/18590#issuecomment-15443484 .

samueljohn commented 11 years ago

show me your PATH, PYTHONPATH and within python the sys.path (needs import sys).

I think you still have a bad "setuptools" and/or "distribute" in either ~/Library... or /Library... that injects the /System/Library into the sys.path. A brewed python does normally not know about stuff in /System/...! This can happen if you installed pip once for system python, I think.

This reminds me that I wanted to write a doctor check for this case.

ssbanerje commented 11 years ago

I did install pip for system python once... But that was a long time ago.

~|⇒ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/Subho/.bin:/Developer/NVIDIA/CUDA-5.0/bin:/Applications/MATLAB_R2012b.app/bin:/usr/texbin:/usr/local/share/npm/bin:/Applications/Dia.app/Contents/Resources/bin
~|⇒ echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages:

I have a '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python' in the sys.path. Is there any way I can get rid of it?

>>> import sys
>>> print sys.path
['', '/usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg', '/usr/local/lib/python2.7/site-packages/SimpleCV-1.3-py2.7.egg', '/Users/Subho/Library/Python/2.7/lib/python/site-packages/Powerline-beta-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/SimpleCV-1.3-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/Library/Python/2.7/site-packages/Jinja2-2.6-py2.7.egg', '/usr/local/lib/python2.7/site-packages', '/Users/Subho', '/usr/local/lib/python2.7/site-packages/PIL', '/usr/local/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/Subho/Library/Python/2.7/lib/python/site-packages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL', '/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa', '/Library/Python/2.7/site-packages']
samueljohn commented 11 years ago

I did install pip for system python once... But that was a long time ago.

Yeah that has proven to mess up any other python installation :-) It's not your fault, though.

  1. Add /usr/local/share/python in front of your PATH.
  2. rm -rf /usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg
  3. rm -rf /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg
  4. brew rm python
  5. brew install python

So if that does not work, then we have to try harder and I suggest to completely wipe out (or backup somewhere) the contents of /Library/Python/2.7/site-packages and reinstall the stuff you got there with pip install <stuff>. If your brew install python it will install the up-to-date distribute and pip, so it might be good to remove anything with "distribute" or "pip" or "setuptools" in it's name before reinstalling python. Just go ahead and delete them.

jacknagel commented 11 years ago

opencv is now part of https://github.com/homebrew/homebrew-science, and its issues are being handled there.