Search code examples
pythonpython-2.7pipmacports

MacPorts pip install links .so file to wrong python executable on MacOS 10.11


I am using MacOS 10.11 and in addition to the native Python installation I have installed Python and Pip through MacPorts. python and pip are linked against the respective MacPorts versions.

However, when installing a package via

sudo pip install <my-package>

a specific .so file of that package is linked against the native Python executable. More precisely the output of otool -L on that .so file is

/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)

whereas the MacPorts version of Python resides at

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/

How can I force Pip to use the correct Python version to link against?


Solution

  • The short version is: you can't.

    It's not a problem with pip. The nupic package relies on the nupic.bindings package, which contains the _math.so you note, and it's currently distributed via PyPI as binary-only:

    https://pypi.python.org/pypi/nupic.bindings

    You can compile your own nupic.bindings package, but the build process looks fairly involved, which is probably why they distribute binary-only:

    https://github.com/numenta/nupic.core

    Good luck!