PyCharm detects installed libraries but suggests the wrong imports in the code
Hi!
I'm using PyCharm 2024.1.1 (Professional Edition) and, since a few days ago, it stopped giving me the right suggestions when I bring up the Actions context menu on an unknown class or method.
For example, below, I'm trying to use "Index" from sqlalchemy but it doesn't show me the correct option:
However, PyCharm detects my installed libraries, and if I manually type the import it gives me the right suggestion as soon as I start typing:
Even though the above suggests the package is installed, I also checked that the library does show up in the interpreter's list of packages:

What I've tried so far (with no success):
- Invalidate cache and restart
- Opening other Python projects (they're all suffering from the same issue)
- Disabling all plugins
Please sign in to leave a comment.
One of my python projects is working fine… This project isn't new and has been set up for a while (same as all the other ones where this problem is happening).
Does this give you any clues?
I've been having a very similar problem. In my case, most standard library packages are not suggested for auto import, while my own code and third-party libs are. When adding the import manually, autocomplete for them works fine (and I can Ctrl+Click to jump to the correct file), so stdlib seems to be indexed correctly.
Edit: it looks like my issue is different. It works in the “Import from…” popup:
But it does not work when I trigger autocomplete (Ctrl+Space / Ctrl+Space+Space):
(Scrolling doesn't help, typing / collections.abc appear nowhere in the list)
Maybe I just have to suck it up and use the “import from” action instead.