RedisLabsModules / redismod

A Docker image with select Redis Labs modules
BSD 3-Clause "New" or "Revised" License
127 stars 28 forks source link

RedisAI is not loaded, it is not possible to use AI interface #7

Closed paold-vel closed 3 years ago

paold-vel commented 4 years ago

Hello. I'm trying to call redisai from redisgears using the built-in redisAI library, but this error appears.

['Traceback (most recent call last):\n', '  File "<string>", line 4, in <module>\n', 'spam.error: RedisAI is not loaded, it is not possible to use AI interface.\n']

I saw the use of the redisAI library in your examples https://github.com/RedisGears/AnimalRecognitionDemo.

Here is the command I'm trying to call from the gear

img_ba = bytearray(np_img.tobytes())
image_tensor = redisAI.createTensorFromBlob('FLOAT', [1, im_height, im_width, 3], img_ba)
filipecosta90 commented 4 years ago

Hi there @paold-vel, good afternoon, using the redislabs/redismod:latest we're getting an error output on RedisGears/RedisAI integration:

1:M 07 Aug 2020 13:23:56.405 # <rg> could not initialize RedisAI_TensorRedisType

1:M 07 Aug 2020 13:23:56.405 # <rg> could not initialize RediAI api, running without AI support.
1:M 07 Aug 2020 13:23:56.405 * <rg> PYENV_DIR: /var/opt/redislabs/modules/rg//python3_1.0.1/

Thank you for bringing this up. Checking why this is happening and will report back.

filipecosta90 commented 4 years ago

@paold-vel in the meantime, if you switch to the the :edge image you should be able to proceed. Confirmed that the RedisAI LLAPI is being properly loaded by Gears (notice the line 1:M 07 Aug 2020 13:47:40.883 * <rg> RedisAI api loaded successfully.):

$ docker run -p 6379:6379 redislabs/redismod:edge
1:C 07 Aug 2020 13:47:40.875 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 07 Aug 2020 13:47:40.875 # Redis version=6.0.1, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 07 Aug 2020 13:47:40.875 # Configuration loaded
1:M 07 Aug 2020 13:47:40.875 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1:M 07 Aug 2020 13:47:40.876 * Running mode=standalone, port=6379.
1:M 07 Aug 2020 13:47:40.876 # Server initialized
1:M 07 Aug 2020 13:47:40.876 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 07 Aug 2020 13:47:40.876 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 07 Aug 2020 13:47:40.876 * <ai> Redis version found by RedisAI: 6.0.1 - oss
1:M 07 Aug 2020 13:47:40.876 * <ai> RedisAI version 999999, git_sha=26faf7e273138f942b16757927574f62d1da58f1
1:M 07 Aug 2020 13:47:40.876 * Module 'ai' loaded from /usr/lib/redis/modules/redisai.so
1:M 07 Aug 2020 13:47:40.877 * <ft> RediSearch version 99.99.99 (Git=v1.99.1-7-gd18d345)
1:M 07 Aug 2020 13:47:40.877 * <ft> Low level api version 1 initialized successfully
1:M 07 Aug 2020 13:47:40.877 * <ft> concurrent writes: OFF, gc: ON, prefix min length: 2, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, search pool size: 20, index pool size: 8, 
1:M 07 Aug 2020 13:47:40.877 * <ft> Initialized thread pool!
1:M 07 Aug 2020 13:47:40.877 * Module 'ft' loaded from /usr/lib/redis/modules/redisearch.so
1:M 07 Aug 2020 13:47:40.881 * <graph> Graph deletion will be done asynchronously.
1:M 07 Aug 2020 13:47:40.881 * <graph> Thread pool created, using 8 threads.
1:M 07 Aug 2020 13:47:40.881 * <graph> Maximum number of OpenMP threads set to 8
1:M 07 Aug 2020 13:47:40.881 * Module 'graph' loaded from /usr/lib/redis/modules/redisgraph.so
1:M 07 Aug 2020 13:47:40.881 * <timeseries> RedisTimeSeries version 999999, git_sha=f06394202307f3bb9280fbd851d2ab8db1d07277
1:M 07 Aug 2020 13:47:40.881 * <timeseries> Redis version found by RedisTimeSeries : 6.0.1 - oss
1:M 07 Aug 2020 13:47:40.881 * Module 'timeseries' loaded from /usr/lib/redis/modules/redistimeseries.so
1:M 07 Aug 2020 13:47:40.881 * <ReJSON> Initializing RediSearch...
1:M 07 Aug 2020 13:47:40.881 * <ReJSON> RediSearch initialized successfully.
1:M 07 Aug 2020 13:47:40.881 * <ReJSON> Created new data type 'ReJSON-RL'
1:M 07 Aug 2020 13:47:40.881 * Module 'ReJSON' loaded from /usr/lib/redis/modules/rejson.so
1:M 07 Aug 2020 13:47:40.882 * Module 'bf' loaded from /usr/lib/redis/modules/redisbloom.so
1:M 07 Aug 2020 13:47:40.883 * <rg> RedisGears version 99.99.99, git_sha=94da9118bd115ab325ee23b37462129e585f9823, compiled_os=linux-buster-x64
1:M 07 Aug 2020 13:47:40.883 * <rg> Redis version found by RedisGears : 6.0.1 - oss
1:M 07 Aug 2020 13:47:40.883 * <rg> MaxExecutions:1000
1:M 07 Aug 2020 13:47:40.883 * <rg> MaxExecutionsPerRegistration:100
1:M 07 Aug 2020 13:47:40.883 * <rg> ProfileExecutions:0
1:M 07 Aug 2020 13:47:40.883 * <rg> PythonAttemptTraceback:1
1:M 07 Aug 2020 13:47:40.883 * <rg> DependenciesUrl:http://redismodules.s3.amazonaws.com/redisgears/redisgears-dependencies.linux-buster-x64.99.99.99.tgz
1:M 07 Aug 2020 13:47:40.883 * <rg> DependenciesSha256:385d19b1e78e05891d301a4c0b4dedac23cbee2dff1f9f3dde069b93268d89aa
1:M 07 Aug 2020 13:47:40.883 * <rg> CreateVenv:0
1:M 07 Aug 2020 13:47:40.883 * <rg> ExecutionThreads:3
1:M 07 Aug 2020 13:47:40.883 * <rg> ExecutionMaxIdleTime:5000
1:M 07 Aug 2020 13:47:40.883 * <rg> PythonInstallReqMaxIdleTime:30000
1:M 07 Aug 2020 13:47:40.883 * <rg> PythonInstallationDir:/var/opt/redislabs/modules/rg
1:M 07 Aug 2020 13:47:40.883 * <rg> DownloadDeps:1
1:M 07 Aug 2020 13:47:40.883 * <rg> ForceDownloadDepsOnEnterprise:0
1:M 07 Aug 2020 13:47:40.883 * <rg> SendMsgRetries:3
1:M 07 Aug 2020 13:47:40.883 * <rg> PythonHomeDir:/opt/redislabs/lib/modules/python3
1:M 07 Aug 2020 13:47:40.883 * <rg> RedisAI api loaded successfully.
1:M 07 Aug 2020 13:47:40.886 * <rg> PYENV_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99/
1:M 07 Aug 2020 13:47:40.886 * <rg> PYENV_HOME_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv/
1:M 07 Aug 2020 13:47:40.886 * <rg> PYENV_BIN_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin
1:M 07 Aug 2020 13:47:40.886 * <rg> PYENV_ACTIVATE: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin/activate_this.py
1:M 07 Aug 2020 13:47:40.886 * <rg> PYENV_ACTIVATE_SCRIPT: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin/activate
1:M 07 Aug 2020 13:47:40.886 * <module> log file is 

1:M 07 Aug 2020 13:47:40.886 * <rg> Found python installation under: /var/opt/redislabs/modules/rg//python3_99.99.99/
1:M 07 Aug 2020 13:47:40.927 * Module 'rg' loaded from /var/opt/redislabs/lib/modules/redisgears.so
1:M 07 Aug 2020 13:47:40.927 * Ready to accept connections
filipecosta90 commented 4 years ago

Linking to the RedisAI issue: https://github.com/RedisAI/RedisAI/issues/442

filipecosta90 commented 3 years ago

Hi there @paold-vel we've identified and fixed this issue on RedisAI on PR https://github.com/RedisAI/RedisAI/pull/450 merged Sep 02. Apart from it, we've also confirmed that this issue does not occur with the current latest and edge images (check <rg> RedisAI api loaded successfully):

redislabs/redismod:latest

$ docker run -p 6379:6379 redislabs/redismod:latest
1:C 25 Nov 2020 17:36:41.595 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 25 Nov 2020 17:36:41.595 # Redis version=6.0.1, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 25 Nov 2020 17:36:41.595 # Configuration loaded
1:M 25 Nov 2020 17:36:41.595 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1:M 25 Nov 2020 17:36:41.596 * Running mode=standalone, port=6379.
1:M 25 Nov 2020 17:36:41.596 # Server initialized
1:M 25 Nov 2020 17:36:41.596 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 25 Nov 2020 17:36:41.596 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 25 Nov 2020 17:36:41.596 * <ai> Redis version found by RedisAI: 6.0.1 - oss
1:M 25 Nov 2020 17:36:41.596 * <ai> RedisAI version 10002, git_sha=97bedfa60238fa0fa6b318b7d9e5df995fe8b5e2
1:M 25 Nov 2020 17:36:41.597 * Module 'ai' loaded from /usr/lib/redis/modules/redisai.so
1:M 25 Nov 2020 17:36:41.597 * <search> Redis version found by RedisSearch : 6.0.1 - oss
1:M 25 Nov 2020 17:36:41.597 * <search> RediSearch version 2.0.3 (Git=v2.0.3)
1:M 25 Nov 2020 17:36:41.597 * <search> Low level api version 1 initialized successfully
1:M 25 Nov 2020 17:36:41.597 * <search> concurrent writes: OFF, gc: ON, prefix min length: 2, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, search pool size: 20, index pool size: 8, 
1:M 25 Nov 2020 17:36:41.597 * <search> Initialized thread pool!
1:M 25 Nov 2020 17:36:41.597 * Module 'search' loaded from /usr/lib/redis/modules/redisearch.so
1:M 25 Nov 2020 17:36:41.601 * <graph> Graph deletion will be done asynchronously.
1:M 25 Nov 2020 17:36:41.602 * <graph> Thread pool created, using 8 threads.
1:M 25 Nov 2020 17:36:41.602 * <graph> Maximum number of OpenMP threads set to 8
1:M 25 Nov 2020 17:36:41.602 * Module 'graph' loaded from /usr/lib/redis/modules/redisgraph.so
1:M 25 Nov 2020 17:36:41.602 * <timeseries> RedisTimeSeries version 10406, git_sha=35b3b2f6d651f8dd5313f661c04bd2c77caacd2c
1:M 25 Nov 2020 17:36:41.602 * <timeseries> Redis version found by RedisTimeSeries : 6.0.1 - oss
1:M 25 Nov 2020 17:36:41.602 * Module 'timeseries' loaded from /usr/lib/redis/modules/redistimeseries.so
1:M 25 Nov 2020 17:36:41.602 # <ReJSON> JSON data type for Redis v1.0.6 [encver 0]
1:M 25 Nov 2020 17:36:41.602 * Module 'ReJSON' loaded from /usr/lib/redis/modules/rejson.so
1:M 25 Nov 2020 17:36:41.602 * Module 'bf' loaded from /usr/lib/redis/modules/redisbloom.so
1:M 25 Nov 2020 17:36:41.603 * <rg> RedisGears version 1.0.3, git_sha=6d6d74b69412bfbbf5bcfe1e951faa523d1b80e4, compiled_os=linux-buster-x64
1:M 25 Nov 2020 17:36:41.603 * <rg> Redis version found by RedisGears : 6.0.1 - oss
1:M 25 Nov 2020 17:36:41.603 * <rg> MaxExecutions:1000
1:M 25 Nov 2020 17:36:41.603 * <rg> MaxExecutionsPerRegistration:100
1:M 25 Nov 2020 17:36:41.603 * <rg> ProfileExecutions:0
1:M 25 Nov 2020 17:36:41.603 * <rg> PythonAttemptTraceback:1
1:M 25 Nov 2020 17:36:41.603 * <rg> DependenciesUrl:http://redismodules.s3.amazonaws.com/redisgears/redisgears-dependencies.linux-buster-x64.1.0.3.tgz
1:M 25 Nov 2020 17:36:41.603 * <rg> DependenciesSha256:799de46b223d4eaaf2c84695648e58db8c502f3ccd4d2b8b09d5365dfd699016
1:M 25 Nov 2020 17:36:41.603 * <rg> CreateVenv:0
1:M 25 Nov 2020 17:36:41.603 * <rg> ExecutionThreads:3
1:M 25 Nov 2020 17:36:41.603 * <rg> ExecutionMaxIdleTime:5000
1:M 25 Nov 2020 17:36:41.603 * <rg> PythonInstallReqMaxIdleTime:30000
1:M 25 Nov 2020 17:36:41.603 * <rg> PythonInstallationDir:/var/opt/redislabs/modules/rg
1:M 25 Nov 2020 17:36:41.603 * <rg> DownloadDeps:1
1:M 25 Nov 2020 17:36:41.603 * <rg> ForceDownloadDepsOnEnterprise:0
1:M 25 Nov 2020 17:36:41.603 * <rg> SendMsgRetries:3
1:M 25 Nov 2020 17:36:41.603 * <rg> PythonHomeDir:/opt/redislabs/lib/modules/python3
1:M 25 Nov 2020 17:36:41.603 * <rg> RedisAI api loaded successfully.
1:M 25 Nov 2020 17:36:41.604 * <rg> PYENV_DIR: /var/opt/redislabs/modules/rg//python3_1.0.3/
1:M 25 Nov 2020 17:36:41.604 * <rg> PYENV_HOME_DIR: /var/opt/redislabs/modules/rg//python3_1.0.3//.venv/
1:M 25 Nov 2020 17:36:41.604 * <rg> PYENV_BIN_DIR: /var/opt/redislabs/modules/rg//python3_1.0.3//.venv//bin
1:M 25 Nov 2020 17:36:41.604 * <rg> PYENV_ACTIVATE: /var/opt/redislabs/modules/rg//python3_1.0.3//.venv//bin/activate_this.py
1:M 25 Nov 2020 17:36:41.604 * <rg> PYENV_ACTIVATE_SCRIPT: /var/opt/redislabs/modules/rg//python3_1.0.3//.venv//bin/activate
1:M 25 Nov 2020 17:36:41.604 * <module> log file is 

1:M 25 Nov 2020 17:36:41.604 * <rg> Found python installation under: /var/opt/redislabs/modules/rg//python3_1.0.3/
1:M 25 Nov 2020 17:36:41.651 * Module 'rg' loaded from /var/opt/redislabs/lib/modules/redisgears.so
1:M 25 Nov 2020 17:36:41.651 * Ready to accept connections

redislabs/redismod:latest

$ docker run -p 6379:6379 redislabs/redismod:edge
1:C 25 Nov 2020 17:47:53.817 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 25 Nov 2020 17:47:53.817 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 25 Nov 2020 17:47:53.817 # Configuration loaded
1:M 25 Nov 2020 17:47:53.818 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1:M 25 Nov 2020 17:47:53.818 * Running mode=standalone, port=6379.
1:M 25 Nov 2020 17:47:53.818 # Server initialized
1:M 25 Nov 2020 17:47:53.818 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 25 Nov 2020 17:47:53.819 * <ai> Redis version found by RedisAI: 6.0.9 - oss
1:M 25 Nov 2020 17:47:53.819 * <ai> RedisAI version 999999, git_sha=d4c66ee121510c9c94a0638b3dfd3f02ae7a5bc7
1:M 25 Nov 2020 17:47:53.819 * Module 'ai' loaded from /usr/lib/redis/modules/redisai.so
1:M 25 Nov 2020 17:47:53.819 * <search> Redis version found by RedisSearch : 6.0.9 - oss
1:M 25 Nov 2020 17:47:53.819 * <search> RediSearch version 99.99.99 (Git=v1.99.5-67-gfda9566)
1:M 25 Nov 2020 17:47:53.819 * <search> Low level api version 1 initialized successfully
1:M 25 Nov 2020 17:47:53.819 * <search> concurrent writes: OFF, gc: ON, prefix min length: 2, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, search pool size: 20, index pool size: 8, 
1:M 25 Nov 2020 17:47:53.820 * <search> Initialized thread pool!
1:M 25 Nov 2020 17:47:53.820 * Module 'search' loaded from /usr/lib/redis/modules/redisearch.so
1:M 25 Nov 2020 17:47:53.824 * <graph> Graph deletion will be done asynchronously.
1:M 25 Nov 2020 17:47:53.824 * <graph> Thread pool created, using 8 threads.
1:M 25 Nov 2020 17:47:53.824 * <graph> Maximum number of OpenMP threads set to 8
1:M 25 Nov 2020 17:47:53.824 * Module 'graph' loaded from /usr/lib/redis/modules/redisgraph.so
1:M 25 Nov 2020 17:47:53.824 * <timeseries> RedisTimeSeries version 999999, git_sha=e3ac99336bf92dfcff0602d29f91e30aca67b895
1:M 25 Nov 2020 17:47:53.824 * <timeseries> Redis version found by RedisTimeSeries : 6.0.9 - oss
1:M 25 Nov 2020 17:47:53.824 * Module 'timeseries' loaded from /usr/lib/redis/modules/redistimeseries.so
1:M 25 Nov 2020 17:47:53.825 * <ReJSON> Created new data type 'ReJSON-RL'
1:M 25 Nov 2020 17:47:53.825 * Module 'ReJSON' loaded from /usr/lib/redis/modules/rejson.so
1:M 25 Nov 2020 17:47:53.825 * Module 'bf' loaded from /usr/lib/redis/modules/redisbloom.so
1:M 25 Nov 2020 17:47:53.826 * <rg> RedisGears version 99.99.99, git_sha=c0431d560d10b2d4c1c3354154d1edab9da3c804, compiled_os=linux-buster-x64
1:M 25 Nov 2020 17:47:53.826 * <rg> Redis version found by RedisGears : 6.0.9 - oss
1:M 25 Nov 2020 17:47:53.827 * <rg> MaxExecutions:1000
1:M 25 Nov 2020 17:47:53.827 * <rg> MaxExecutionsPerRegistration:100
1:M 25 Nov 2020 17:47:53.827 * <rg> ProfileExecutions:0
1:M 25 Nov 2020 17:47:53.827 * <rg> PythonAttemptTraceback:1
1:M 25 Nov 2020 17:47:53.827 * <rg> DependenciesUrl:http://redismodules.s3.amazonaws.com/redisgears/redisgears-dependencies.linux-buster-x64.99.99.99.tgz
1:M 25 Nov 2020 17:47:53.827 * <rg> DependenciesSha256:2857ee63e3e38aae38a96b4a19d3397f3257f05f4169956ac9c030911b01f9dc
1:M 25 Nov 2020 17:47:53.827 * <rg> CreateVenv:0
1:M 25 Nov 2020 17:47:53.827 * <rg> ExecutionThreads:3
1:M 25 Nov 2020 17:47:53.827 * <rg> ExecutionMaxIdleTime:5000
1:M 25 Nov 2020 17:47:53.827 * <rg> PythonInstallReqMaxIdleTime:30000
1:M 25 Nov 2020 17:47:53.827 * <rg> PythonInstallationDir:/var/opt/redislabs/modules/rg
1:M 25 Nov 2020 17:47:53.827 * <rg> DownloadDeps:1
1:M 25 Nov 2020 17:47:53.827 * <rg> ForceDownloadDepsOnEnterprise:0
1:M 25 Nov 2020 17:47:53.827 * <rg> SendMsgRetries:3
1:M 25 Nov 2020 17:47:53.827 * <rg> PluginsDirectory:/var/opt/redislabs/modules/rg/plugins
1:M 25 Nov 2020 17:47:53.827 * <rg> PythonHomeDir:/opt/redislabs/lib/modules/python3
1:M 25 Nov 2020 17:47:53.827 * <rg> RedisAI api loaded successfully.
1:M 25 Nov 2020 17:47:53.827 * <rg> PYENV_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99/
1:M 25 Nov 2020 17:47:53.827 * <rg> PYENV_HOME_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv/
1:M 25 Nov 2020 17:47:53.827 * <rg> PYENV_BIN_DIR: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin
1:M 25 Nov 2020 17:47:53.827 * <rg> PYENV_ACTIVATE: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin/activate_this.py
1:M 25 Nov 2020 17:47:53.827 * <rg> PYENV_ACTIVATE_SCRIPT: /var/opt/redislabs/modules/rg//python3_99.99.99//.venv//bin/activate
1:M 25 Nov 2020 17:47:53.827 * <module> log file is 

1:M 25 Nov 2020 17:47:53.827 * <rg> Found python installation under: /var/opt/redislabs/modules/rg//python3_99.99.99/
1:M 25 Nov 2020 17:47:53.907 # <rg> Plugins directory does not exists
1:M 25 Nov 2020 17:47:53.907 * Module 'rg' loaded from /var/opt/redislabs/lib/modules/redisgears.so
1:M 25 Nov 2020 17:47:53.907 * Ready to accept connections

Closing this issue. Feel free to re-open of this is not the case on your side / want further info.