Skip to content

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

Open
@Ppang0405

Description

@Ppang0405

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?

Activity

eudoxos

eudoxos commented on Dec 11, 2024

@eudoxos

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).

ticapix

ticapix commented on Jun 18, 2025

@ticapix

you need to install fastapi_cache2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @eudoxos@ticapix@Ppang0405

        Issue actions

          ImportError: cannot import name 'FastAPICache' from 'fastapi_cache' · Issue #489 · long2ice/fastapi-cache