Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library is unusable with redis older than 4.2.0 installed, even if redis isn't used #693

Open
gcbirzan-plutoflume opened this issue Mar 16, 2023 · 2 comments

Comments

@gcbirzan-plutoflume
Copy link

The Python redis library didn't have async support before 4.2.0, but the check for whether redis is installed doesn't take that into account:

import redis

If redis is importable, the code then goes on to import redis.asyncio, which for older versions doesn't exist:

import redis.asyncio as redis

While, technically, this isn't something that one should do, we hit this problem because of our complicated dependencies, where an internal library we use in our async code also depends on an older redis, even though that part is not used by our async code.

I think rather than hardcoding a version check, an import redis.asyncio in the try/except block.

@Dreamsorcerer
Copy link
Member

I guess it's a little complex when it comes to optional dependencies. If you used aiocache[redis], then the dependency resolution would work correctly and require 4.2+. Maybe we can tweak that import as suggested though (although I expect most users will already have migrated and won't encounter this issue).

@Eli-Chandler
Copy link

#745
I faced this issue when using this library https://pypi.org/project/profanity-filter/ which requires redis<4.0 (apparently although I managed to fix this issue by just bypassing the requirements)
There definitely should be a version check for >=4.2.0 though because finding the source of this issue was a pain
Really frustrating cause I only needed to use the memory based cache

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

No branches or pull requests

3 participants