I have faced a strange issue with automatic requirement.txt in pycharm.
When I run pip freeze > requirements.txt
as always, it adds multiple packages from my virtual environment (some of them I do not use). I need to add only modules that are currently in all imports in my python project (Python 3.12.2)
So, when I run command Add imported packages to requirements
I see loading screen and after that my requirements file is still empty.
gif from my pycharm
I tried different options in Add imported packages to requirements
command. I tried pip freeze
from global environment (It adds all packages from global python interpreter). I tried .venvScriptspip.exe freeze
(It adds some of useless modules). I guess, I can manually add imported modules with versions from pip list
, but I think this way pip install requirements.txt
in the future will work incorrectly.
What can I do to make automatic pycharm command work to generate requirements.txt correctly?
My assumption: this bug is somehow connected with virtual environment.