Successful install of `pip install -e` but all imports are flagged as errors in PyCharm

Question:

A package I developed named my_package that worked fine for over a year when installing using pip install -e, lately started to flag an error when importing it. The installation is successful and everything works fine at runtime but import my_package is flagged as No module named my_package in PyCharm. What can be the reason?

Asked By: Ilya

||

Answers:

It’s a fairly long-standing bug in PyCharm. One workaround is to mark your package as "Sources" manually in the "Project Structure" of your project’s settings.

Answered By: dorian
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.