Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

TypeError: duplicate base class TimeoutError #1443

Open
1 task done
farahats9 opened this issue Nov 2, 2022 · 2 comments
Open
1 task done

TypeError: duplicate base class TimeoutError #1443

farahats9 opened this issue Nov 2, 2022 · 2 comments
Labels

Comments

@farahats9
Copy link

Describe the bug

When trying to import aioredis in Python 3.11 an error is raised

To Reproduce

1- use python 3.11
2- try to import aioredis
3- this error is raised:

>>> import aioredis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib64/python3.11/site-packages/aioredis/__init__.py", line 1, in <module>
    from aioredis.client import Redis, StrictRedis
  File ".venv/lib64/python3.11/site-packages/aioredis/client.py", line 32, in <module>
    from aioredis.connection import (
  File ".venv/lib64/python3.11/site-packages/aioredis/connection.py", line 33, in <module>
    from .exceptions import (
  File ".venv/lib64/python3.11/site-packages/aioredis/exceptions.py", line 14, in <module>
    class TimeoutError(asyncio.TimeoutError, builtins.TimeoutError, RedisError):
TypeError: duplicate base class TimeoutError

Expected behavior

it should import correctly without errors. I think the problem is in aioredis/exceptions.py#L14

class TimeoutError(asyncio.TimeoutError, builtins.TimeoutError, RedisError):
    pass

The asyncio.TimeoutError is inheriting from builtins.TimeoutError and they are both used as base classes which python doesn't like.

Logs/tracebacks

already added above

Python Version

$ python --version
3.11.0

aioredis Version

$ python -m pip show aioredis
Name: aioredis
Version: 2.0.1
Summary: asyncio (PEP 3156) Redis support
Home-page: https://github.com/aio-libs/aioredis-py
Author: 
Author-email: 
License: MIT
Location: /mnt/d/dev/python/smsarko/smsarko-fastapi/.venvl/lib64/python3.11/site-packages
Requires: async-timeout, typing-extensions
Required-by:

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@iasukas
Copy link

iasukas commented Nov 4, 2022

Aioredis is now in redis-py 4.2.0rc1+

To install, just do pip install redis>=4.2.0rc1. The code is almost the exact same. You will just need to import like so:
from redis import asyncio as aioredis

This way you don't have to change all your code, just the imports.

@sheraff0
Copy link

sheraff0 commented Nov 7, 2022

Aioredis is now in redis-py 4.2.0rc1+

To install, just do pip install redis>=4.2.0rc1. The code is almost the exact same. You will just need to import like so: from redis import asyncio as aioredis

This way you don't have to change all your code, just the imports.

Thanks, that worked!

Had the described problem because of fastapi-mail dependency.

Added redis>=4.2.0rc1 to requirements.txt.

Also, created aioredis.py in app's root folder containing
from redis.asyncio import *

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants