PyCV on OSX

6.17.09

PyCV is not supported on the Mac, and for that it is no surprise that it does not successfully compile. (These are hacks to make it work, not elegant solutions that are endorsed by the people who make PyCV) There were two major hurdles to making it work.

First is error that happens in the system_info.py which reads something like:

File "/sw/lib/python2.6/site-packages/numpy/distutils/cpuinfo.py"
line 79, in __getattr__
raise AttributeError,name
AttributeError: _has_sse2

To fix this you must edit the file system_info.py lines 107-114 to becoming:

#if cpu._has_sse2() and (dcomp == 'mingw32' or dcomp == 'gcc'):
extra_args = ['-arch x86_64', '-O3', '-msse2', '-mfpmath=sse', '-malign-double']
#    if get_gcc_version() >= '4.2':
extra_args.append('-mtune=generic')
#    else:
#        extra_args.append('-march=pentium4')
#        extra_args.append('-mtune=pentium4')
#info['extra_compiler_args'].extend(extra_args)}}}

This fixes the above error and also fixes an assembly error that happens later when compiling Blas bindings. The error:

error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’

The error is fixed by specifying the architecture of the computer, in this case x86_64.