mushorg / tanner

He who flays the hide
GNU General Public License v3.0
220 stars 101 forks source link

AttributeError: module 'aioredis' has no attribute 'create_redis_pool' #410

Closed grispan56 closed 2 years ago

grispan56 commented 3 years ago

Im trying to run tanner whether by docker-compose or by manually installing , tried on multiple computers as well but getting the same error everytime, is there something missing in the instructions or anyway to solve it?

root@ip-172-31-3-81:/home/ubuntu/tanner/docker# docker-compose up
Starting tanner_phpox ... done
Starting tanner_redis ... done
Starting tanner_web   ... done
Starting tanner_api   ... done
Starting tanner       ... done
Attaching to tanner_phpox, tanner_redis, tanner_api, tanner_web, tanner
tanner_phpox    | sandbox.py:115: DeprecationWarning: Application.make_handler(...) is deprecated, use AppRunner API instead
tanner_phpox    |   handler = app.make_handler()
tanner_phpox    | serving on ('127.0.0.1', 8088)
tanner_redis    | 1:C 24 Aug 2021 09:37:44.938 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
tanner_redis    | 1:C 24 Aug 2021 09:37:44.938 # Redis version=6.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
tanner_redis    | 1:C 24 Aug 2021 09:37:44.938 # Configuration loaded
tanner_redis    | 1:M 24 Aug 2021 09:37:44.939 * monotonic clock: POSIX clock_gettime
tanner_redis    |                 _._                                                  
tanner_redis    |            _.-``__ ''-._                                             
tanner_redis    |       _.-``    `.  `_.  ''-._           Redis 6.2.5 (00000000/0) 64 bit
tanner_redis    |   .-`` .-```.  ```\/    _.,_ ''-._                                  
tanner_redis    |  (    '      ,       .-`  | `,    )     Running in standalone mode
tanner_redis    |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
tanner_redis    |  |    `-._   `._    /     _.-'    |     PID: 1
tanner_redis    |   `-._    `-._  `-./  _.-'    _.-'                                   
tanner_redis    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
tanner_redis    |  |    `-._`-._        _.-'_.-'    |           https://redis.io       
tanner_redis    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
tanner_redis    |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
tanner_redis    |  |    `-._`-._        _.-'_.-'    |                                  
tanner_redis    |   `-._    `-._`-.__.-'_.-'    _.-'                                   
tanner_redis    |       `-._    `-.__.-'    _.-'                                       
tanner_redis    |           `-._        _.-'                                           
tanner_redis    |               `-.__.-'                                               
tanner_redis    | 
tanner_redis    | 1:M 24 Aug 2021 09:37:44.942 # Server initialized
tanner_redis    | 1:M 24 Aug 2021 09:37:44.942 # 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.
tanner_redis    | 1:M 24 Aug 2021 09:37:44.943 * Ready to accept connections
tanner_api      | Traceback (most recent call last):
tanner_api      |   File "/usr/bin/tannerapi", line 4, in 
tanner_api      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerapi')
tanner_api      |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 667, in run_script
tanner_api      |     self.require(requires)[0].run_script(script_name, ns)
tanner_api      |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1471, in run_script
tanner_api      |     exec(script_code, namespace, namespace)
tanner_api      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tannerapi", line 20, in 
tanner_api      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tannerapi", line 16, in main
tanner_api      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/tanner/api/server.py", line 108, in start
tanner_api      |   File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
tanner_api      |     return future.result()
tanner_api      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/tanner/redis_client.py", line 22, in get_redis_client
tanner_api      | AttributeError: module 'aioredis' has no attribute 'create_redis_pool'
tanner_web      | Traceback (most recent call last):
tanner_web      |   File "/usr/bin/tannerweb", line 4, in 
tanner_web      |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tannerweb')
tanner_web      |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 667, in run_script
tanner_web      |     self.require(requires)[0].run_script(script_name, ns)
tanner_web      |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1471, in run_script
tanner_web      |     exec(script_code, namespace, namespace)
tanner_web      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tannerweb", line 20, in 
tanner_web      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tannerweb", line 16, in main
tanner_web      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/tanner/web/server.py", line 106, in start
tanner_web      |   File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
tanner_web      |     return future.result()
tanner_web      |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/tanner/redis_client.py", line 22, in get_redis_client
tanner_web      | AttributeError: module 'aioredis' has no attribute 'create_redis_pool'

`            
valvolt commented 3 years ago

Wow, I was about to open the same issue ! I've found a workaround: in requirements.txt, downgrade the version of aioredis to 1.3.1:

aioredis==1.3.1

With this I got tanner running locally.

mzfr commented 3 years ago

aioredis v2.0 made lot of changes(https://aioredis.readthedocs.io/en/latest/migration/). In that, they have changed the way to connect to a pool.

@afeena should we restrict the version in the requirements? or should we make the suggested changes to make it compatible with the latest version?

grispan56 commented 3 years ago

@valvolt which version of python/linux dist you use ?

I also tried to change the requirements to 1.3.1, but It gave different error,

  File "/usr/local/lib/python3.8/dist-packages/aiohttp/helpers.py", line 30
    ensure_future = asyncio.async
                            ^
SyntaxError: invalid syntax

as much as i could find since python version 3.7 async became a reserved word so thats why the error come ? I tried to run it on python 3.8.10

Wow, I was about to open the same issue ! I've found a workaround: in requirements.txt, downgrade the version of aioredis to 1.3.1:

aioredis==1.3.1

With this I got tanner running locally.

valvolt commented 3 years ago

I've used the docker-compose setup. Basically, I added a sed command to the Tanner Dockerfile, so that it looks like this:

git clone --depth=1 https://github.com/mushorg/tanner /opt/tanner && \
cp /root/dist/config.yaml /opt/tanner/tanner/data/ && \
cd /opt/tanner/ && \
sed -i 's/aioredis/aioredis==1.3.1/g' requirements.txt && \
pip3 install --no-cache-dir setuptools && \
pip3 install --no-cache-dir -r requirements.txt && \
python3 setup.py install && \
cd / && \
pklanka commented 2 years ago

After downgrading to 1.3.1, I am receiving the following error. Could you please help

tanner          | Traceback (most recent call last):
tanner          |   File "/usr/bin/tanner", line 4, in <module>
tanner          |     __import__('pkg_resources').run_script('Tanner==0.6.0', 'tanner')
tanner          |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 667, in run_script
tanner          |     self.require(requires)[0].run_script(script_name, ns)
tanner          |   File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1471, in run_script
tanner          |     exec(script_code, namespace, namespace)
tanner          |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tanner", line 37, in <module>
tanner          |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/EGG-INFO/scripts/tanner", line 33, in main
tanner          |   File "/usr/lib/python3.7/site-packages/Tanner-0.6.0-py3.7.egg/tanner/server.py", line 139, in start
tanner          |   File "/usr/lib/python3.7/site-packages/aiohttp/web.py", line 514, in run_app
tanner          |     loop.run_until_complete(main_task)
tanner          |   File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
tanner          |   File "/usr/lib/python3.7/site-packages/aiohttp/web.py", line 321, in _run_app
tanner          |     await runner.setup()
tanner          |   File "/usr/lib/python3.7/site-packages/aiohttp/web_runner.py", line 279, in setup
tanner          |     self._server = await self._make_server()
tanner          |   File "/usr/lib/python3.7/site-packages/aiohttp/web_runner.py", line 373, in _make_server
tanner          |     self._app._set_loop(loop)
tanner          |   File "/usr/lib/python3.7/site-packages/aiohttp/web_app.py", line 224, in _set_loop
tanner          |     "web.Application instance initialized with different loop"
tanner          | RuntimeError: web.Application instance initialized with different loop
Chrzi commented 2 years ago

Got the same error as @pklanka. I found the workaround to use an older version of aiohttp and adding this to my Dockerfile: sed -i 's/^aiohttp$/aiohttp==3.7.4.post0/g' requirements.txt && \

t3chn0m4g3 commented 2 years ago

@mzfr @afeena Are you planning on updating Tanner, right out of the box it builds, but without the changes proposed by @Chrzi and @valvolt it crashes on start.

afeena commented 2 years ago

I would be happy to merge changes, @Chrzi @valvolt would you like to do a pull request?

If not I will add the changes myself :)

Chrzi commented 2 years ago

No thanks :)

danielkelley743 commented 2 years ago

Did this issue ever get resolved? I'm advising a friend on how to setup tanner and the docker image still appears to have Redis errors.

t3chn0m4g3 commented 2 years ago

@ibuydan Use the version bundled with T-Pot, works like a charm.

afeena commented 2 years ago

414 resolved :)