RedisAI - Error loading backend

Hi!

I am getting “ERR error loading backend” using the following command:

" redis-cli AI.CONFIG LOADBACKEND TF redisai_tensorflow/redisai_tensorflow.so"

and the server says:

"Could not load TF backend from /Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so: dlopen(/Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so, 6): Library not loaded: @rpath/libtensorflow.so

Referenced from: /Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so

Reason: image not found"

Though the .so file is there. Do you have an idea why this is?

Thanks!!

Hello Kim,
I’m assuming you built RedisAI from source from the current master, is that correct?

It looks like rpath hasn’t been set during the build. Please make sure you ran “make install” at the end of the build, and that the redisai.so and the backend files you’re loading are those in the “install-cpu” directory (it was named “install” a couple of PRs ago, in case your repo is not up to date).

The “make install” phase is the one in which CMake sets the rpath, so it’s important that it is executed.

In case this doesn’t work, please also send the output of

otool -L install-cpu/backends/redisai_tensorflow/redisai_tensorflow.so

and

otool -l install-cpu/backends/redisai_tensorflow/redisai_tensorflow.so | grep --context=8 RPATH

Thanks

Luca

Hi Luca,

I am rebuilding it again from scratch today using the following instructions:

Once the dependencies are downloaded, build the module itself. Note that CMake 3.0 or higher is required.

mkdir build
cd build
cmake ..
make && make install
cd ..

At the moment, I am running into this error at the “make && make install” step:

make: *** No rule to make target `48476’. Stop.

Current file structure is in attached image.

Any advice is appreciated!

Kim

I also forget to mention that the link to microsoft onnxruntime in get_deps.sh did not work. I downloaded it manually, by the way.

Hello Kim,
this is odd, I just tested get_deps.sh on my macos and it works for me. Can you post the exact link that the get_deps.sh script tries to download?

I’m also surprised by the error message. Can you also post CMakeCache.txt inside your build directory?

Thanks

Luca

Yes, the link is from: https://github.com/RedisAI/RedisAI/blob/master/get_deps.sh

wget -q https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/${ORT_ARCHIVE}

I changed it to:

https://github.com/microsoft/onnxruntime/releases

Yes, the link is from: https://github.com/RedisAI/RedisAI/blob/master/get_deps.sh

wget -q https://github.com/microsoft/onnxruntime/releases/download/v{ORT_VERSION}/{ORT_ARCHIVE}

Hello Kim,
this is odd, I just tested get_deps.sh on my macos and it works for me. Can you post the exact link that the get_deps.sh script tries to download?

I’m also surprised by the error message. Can you also post CMakeCache.txt inside your build directory?

Thanks

Luca

I also forget to mention that the link to microsoft onnxruntime in get_deps.sh did not work. I downloaded it manually, by the way.

Hi Luca,

I am rebuilding it again from scratch today using the following instructions:

Once the dependencies are downloaded, build the module itself. Note that CMake 3.0 or higher is required.

mkdir build
cd build
cmake ..
make && make install
cd ..

At the moment, I am running into this error at the “make && make install” step:

make: *** No rule to make target `48476’. Stop.

Current file structure is in attached image.

Any advice is appreciated!

Kim

Hello Kim,
I’m assuming you built RedisAI from source from the current master, is that correct?

It looks like rpath hasn’t been set during the build. Please make sure you ran “make install” at the end of the build, and that the redisai.so and the backend files you’re loading are those in the “install-cpu” directory (it was named “install” a couple of PRs ago, in case your repo is not up to date).

The “make install” phase is the one in which CMake sets the rpath, so it’s important that it is executed.

In case this doesn’t work, please also send the output of

otool -L install-cpu/backends/redisai_tensorflow/redisai_tensorflow.so

and

otool -l install-cpu/backends/redisai_tensorflow/redisai_tensorflow.so | grep --context=8 RPATH

Thanks

Luca

Hi!

I am getting “ERR error loading backend” using the following command:

" redis-cli AI.CONFIG LOADBACKEND TF redisai_tensorflow/redisai_tensorflow.so"

and the server says:

"Could not load TF backend from /Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so: dlopen(/Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so, 6): Library not loaded: @rpath/libtensorflow.so

Referenced from: /Users/kimnguyen/redis/redis-5.0.5/backends/redisai_tensorflow/redisai_tensorflow.so

Reason: image not found"

Though the .so file is there. Do you have an idea why this is?

Thanks!!

Correct, although the vars (ORT_VERSION and ORT_ARCHIVE) should make the uurl expand to

https://github.com/microsoft/onnxruntime/releases/download/v0.5.0/onnxruntime-osx-x64-0.5.0.tgz

which is working for me. I wonder what went wrong in your case.

Luca

It is no longer at …/download/…

I think the actual link is now:

https://github.com/microsoft/onnxruntime/releases/v0.5.0/onnxruntime-osx-x64-0.5.0.tgz

Also do you know the issue with the “make” command?

For me
wget https://github.com/microsoft/onnxruntime/releases/download/v0.5.0/onnxruntime-osx-x64-0.5.0.tgz

works, while

wget https://github.com/microsoft/onnxruntime/releases/v0.5.0/onnxruntime-osx-x64-0.5.0.tgz

returns a 404.

If you Copy Link from the page at https://github.com/microsoft/onnxruntime/releases and paste it, you still get

https://github.com/microsoft/onnxruntime/releases/download/v0.5.0/onnxruntime-osx-x64-0.5.0.tgz

I tried to reproduce on my system (I’m also on a Mac) but no luck. Can you
find . -name 48476

or

grep 48476

to see what’s the matter with that target? I couldn’t find it anywhere, it’s very odd.

Luca

I am doing a recursive grep right now. Will take a while…

It returns nothing.

So if you run the make commands sequentially, it seems to work:

make

make install

Now, I am looking for a graph.db that works. Running

redis-cli -x AI.MODELSET foo TF CPU INPUTS a b OUTPUTS c < test/test_data/graph.pb

gives me

ERR: Invalid GraphDef

All good. I manually download again the graph.db, it seems to work. Somehow the file was corrupted when I downloaded the zip file. Thank you!