comeuplater / fastapi_cache

FastAPI simple cache
MIT License
219 stars 19 forks source link

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

Open chenuratikah opened 3 years ago

chenuratikah commented 3 years ago

I have the following issue when try running the API from my docker image. Running it locally, has no issue.

This is my requirements.txt:

fastapi==0.63.0
fastapi-cache==0.1.0

Full error message:

from api.routers import sa_ranking, sa_person_ranking
  File "./api/routers/sa_ranking.py", line 9, in <module>
    from fastapi_cache import FastAPICache
ImportError: cannot import name 'FastAPICache' from 'fastapi_cache' (/usr/local/lib/python3.8/site-packages/fastapi_cache/__init__.py)

Please help! Urgent need

u8sand commented 2 years ago

I know this is quite old but I ran into this myself and found this through google search. For others who run into this, it's likely you've installed fastapi-cache in Docker but fastapi-cache2 locally; https://github.com/long2ice/fastapi-cache is the repo for fastapi-cache2.