Apparently Mac OS X El Capitan can't use the NAOqi Python SDK due to a new security feature called System Integrity Protection (SIP).
If you get an error like this, it's due to the security features provided by SIP.
>>> import naoqi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tkawata/naoqi/pynaoqi-python2.7-2.4.2.26-mac64/naoqi.py", line 9, in <module>
import qi
File "/Users/tkawata/naoqi/pynaoqi-python2.7-2.4.2.26-mac64/qi/__init__.py", line 66, in <module>
from _qi import Application as _Application
ImportError: dlopen(/Users/tkawata/naoqi/pynaoqi-python2.7-2.4.2.26-mac64/_qi.so, 2): Library not loaded: libboost_python.dylib
Referenced from: /Users/tkawata/naoqi/pynaoqi-python2.7-2.4.2.26-mac64/_qi.so
Reason: unsafe use of relative rpath libboost_python.dylib in /Users/tkawata/naoqi/pynaoqi-python2.7-2.4.2.26-mac64/_qi.so with restricted binary
>>>
There seems to be a problem with how the library referenced by the SDK is referenced, and I have to wait for the SDK to be officially fixed. (Each NAOqi 2.4.2 SDK is currently supported by Yosemite on Mac)
It's a temporary response, but I made a script to apply the patch.
patch_naoqi_python_sdk_for_elcaptain.sh
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Parameter error" 1>&2
echo "sh patch_naoqi_python_sdk_for_elcaptain.sh naoqi_python_sdk path"
exit 1
fi
NAOQIDIR=$1 # "${HOME}/naoqi/pynaoqi-python2.7-2.4.2.26-mac64"
if [ ! -e ${NAOQIDIR}/naoqi.py ]; then
echo "The specified path doesn't seem to be the naoqi python SDK"
exit 1
fi
cd ${NAOQIDIR}
for file in `ls *.dylib *.so`
do
# patch all library internal cross references
echo "Patching " $file "..."
for fileother in `ls *.dylib *.so ;ls qi *.dylib *.so`
do
# library
echo " Patching " $fileother " with " $file "..."
install_name_tool -change $file $NAOQIDIR/$file $fileother
done
# patch Python reference for the library
install_name_tool -change /Library/Frameworks/Python.framework/Versions/2.7/Python /System/Library/Frameworks/Python.framework/Versions/2.7/Python $file
done
for file in `ls *.dylib *.so`
do
# patch all library internal cross references
echo "Patching " $file "..."
fileother="qi/plugins/libqimodule_python_plugin.dylib"
# library
echo " Patching " $fileother " with " $file "..."
install_name_tool -change $file $NAOQIDIR/$file $fileother
# patch Python reference for the library
install_name_tool -change /Library/Frameworks/Python.framework/Versions/2.7/Python /System/Library/Frameworks/Python.framework/Versions/2.7/Python $file
done
Specify the path of NAOqi SDK in the parameter
sh patch_naoqi_python_sdk_for_elcaptain.sh Python NAOqi SDK path
Recommended Posts