Closed tselnekovic closed 7 years ago
Hi Tomas, Well spotted. Thanks! And thank you for taking the time to log an issue, and not just drive-by :-) . Much appreciated :-)
So, here is a draft script that might fix the problem:
#!/bin/bash
TF_PYPKG_DIR=$1
set -x
set -e
# patch on _pywrap_tensorflow
for libname in cocl clew easycl clblast; do {
old_rpath=$(otool -L ${TF_PYPKG_DIR}/python/_pywrap_tensorflow.so | grep ${libname} | awk '{print $1}')
echo old_rpath ${old_rpath}
install_name_tool -change \
${old_rpath} \
"@loader_path/../third_party/coriander/lib${libname}.dylib" \
${TF_PYPKG_DIR}/python/_pywrap_tensorflow.so
} done
otool -L ${TF_PYPKG_DIR}/python/_pywrap_tensorflow.so
function patch_lib {
# libname, eg: cocl
# (ie, excludes .dylib suffix, and lib prefix)
targetlibname=$1
relpath=$2
libs=$3
echo libname $libname
echo relpath $relpath
echo libs $libs
target_dylib=${TF_PYPKG_DIR}/third_party/coriander/lib${targetlibname}.dylib
for libname in ${libs}; do {
otool -L ${target_dylib}
old_rpath=$(otool -L ${target_dylib} | grep ${libname} | awk '{print $1}')
echo old_rpath ${old_rpath}
new_path="@loader_path/${relpath}/lib${libname}.dylib"
echo new path $new_path
if [[ x${old_rpath} == x ]]; then {
install_name_tool -add_rpath \
"${new_path}" \
${target_dylib}
} else {
install_name_tool -change \
${old_rpath} \
"${new_path}" \
${target_dylib}
} fi
otool -L ${target_dylib}
} done
}
patch_lib easycl . "clew"
patch_lib cocl . "easycl clblast clew"
patch_lib clblast . "clew"
Please save this eg as patch_tf_coriander.sh
, then run like this:
chmod +x patch_tf_coriander.sh
./patch_tf_coriander.sh /Users/tomas/anaconda/envs/py35/lib/python3.5/site-packages/tensorflow
Can you let me know to what extent this does/doesnt work, and if it doesnt, then provide the full output of running it, and of trying to run tensorflow, please?
New wheel v0.17.3 hopefully fixes this https://github.com/hughperkins/tf-coriander/releases/tag/v0.17.3
the binary version 0.17.3 fixes the problem for me. many thanks.
Ok, great! :-)
I am using "anaconda" python 3.5 on Mac OSX Sierra. I have downloaded and installed the binary wheel file: "pip install tensorflow-0.11.0rc0-py3-none-any.whl" (version v0.17.2)
When I try to run the tensorflow tests or try to run any of the examples from: https://github.com/aymericdamien/TensorFlow-Examples I get an error:
File "", line 919, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: dlopen(/Users/tomas/anaconda/envs/py35/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: /Users/hugh2/git-local/tensorflow-llvm40-addingconv/third_party/coriander/build/libclew.dylib
Referenced from: /Users/tomas/anaconda/envs/py35/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so
Reason: image not found
The provided binary WHL file has a fixed path dependency to the "libclew.dylib" file in the following directory: "/Users/hugh2/git-local/tensorflow-llvm40-addingconv/third_party/coriander/build/"
Thanks for fixing this problem.