fastapi-cache icon indicating copy to clipboard operation
fastapi-cache copied to clipboard

ImportError: cannot import name 'FastAPICache' from 'fastapi_cache'

Open Ppang0405 opened this issue 1 year ago • 2 comments

I got an import error when running examples app from this repo, in both Redis and InMemory cache examples.

ImportError: cannot import name 'FastAPICache' from 'fastapi_cache' 

the line got error

from fastapi_cache import FastAPICache

python version 3.11.10 does anyone encounter this issue before or know how can I fix it?

Ppang0405 avatar Dec 08 '24 11:12 Ppang0405

It must be a new upload to pypi; there is no __init__.py installed, whence the error. You can check out (I am not affiliated) fastapi-cache2-fork package instead which works (but is only available for python 3.11 and 3.12).

eudoxos avatar Dec 11 '24 11:12 eudoxos

you need to install fastapi_cache2

ticapix avatar Jun 18 '25 21:06 ticapix