1

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?

madison54
  • 743
  • 2
  • 8
  • 19
  • 1
    Probably best to setup a virtual environment. See [this answer](http://stackoverflow.com/a/37128342/6084928). – Lex Scarisbrick Jun 20 '16 at 20:41
  • @LexScarisbrick : Thanks for the link! However, when installing the package in the virtual environment, the .so file is still linked against the native system python. Do I have to modify any configs prior to calling pip in the virtual environment? – madison54 Jun 21 '16 at 13:10
  • Interesting. Which package and where can it be fetched? If the package isn't publicly available, does the `setup.py` in the package have a [shebang](http://stackoverflow.com/q/1530702/6084928)? – Lex Scarisbrick Jun 21 '16 at 13:30
  • It is publicly available from PyPi. It is the nupic package. When calling pip install nupic, it also installs the package nupic.bindings. Therein is the nupic/bindings/_math.so file which is linked against the incorrect python distribution. – madison54 Jun 21 '16 at 13:35

1 Answers1

1

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!

Lex Scarisbrick
  • 1,540
  • 1
  • 24
  • 31