Why is PyCharm trying to first install a module? (bug or new functionality?)

There is a functionality that seems to have changed between the 2020.x and the 2021.1 version: when I type the name of a method form a module that is not imported, one of the resolutions in 2020.x was "Import module". This was adding `import the_needed_module` at the top of the code.

With 2021.1, it systematically suggests "Install and import", even when the module is already installed. This is simple to check: manually adding `import the_needed_module` fixes the issue.

It looks like in the new version the existence of the module is not checked and always defaults to "not installed"

0
4 comments

Hi, please try **File | Invalidate Caches / Restart… | Invalidate and Restart**, does the issue still reproduce? If positive, is it possible to provide minimal code sample to reproduce the issue? 

1

Andrey Resler: thank you! Invalidating the cacher worked, I am now suggested to just import the module (and not install and import).

0

Andrey Resler: unfortunately the problem is back. This morning, when I restarted PyCharm it started to ask me to "install and import" again (instead of just "import").

I think this may be a bug in how the cache is handled.

EDIT: when I add the import statement manually, PyCharm suggests the name of the package (as I am typing).

0

There was a problem recently with indexing - https://youtrack.jetbrains.com/issue/PY-48089

It will be fixed in the next update planned for Apr 19

Could you please test again after the update?

0

Please sign in to leave a comment.