Reputation: 71
This issue does not cause an actual problem when running the code, but rather is an issue of a PyCharm warning that I would like resolved so other programmers working on the project do not have to waste time investigating. The issue is that I have an import statement referencing an installed package:
import barcode
However, in my requirements.txt file the package is listed as:
python-barcode==0.10.0
This causes PyCharm to generate a warning stating that:
Package containing module 'barcode' is not listed in project requirements less... (Ctrl+F1) Inspection info: This inspection warns about imported or required, but not installed packages.
I was wondering if anyone knew of a way I could permanently avoid this warning for future programmers working in their own IDE, perhaps via a directive in the requirements.txt file, or something to that effect.
Upvotes: 7
Views: 1431
Reputation: 8525
To handle such cases PyCharm team has scrapped PyPI once, the result mapping is bundled with the IDE and is stored in <PyCharm_installation_path>/helpers/tools/packages
. It was a while ago so new packages are missing. See the ticket in PyCharm's bug tracker https://youtrack.jetbrains.com/issue/PY-27985
Feel free to edit helpers/tools/packages
manually and File | Invalidate Cache & Restart to apply changes.
Update: in PyCharm 2020.3.x the packages list is located in plugins\python\lib\python.jar
archive. File tools\packages
inside it.
Upvotes: 6