I use pip freeze > requirements.txt
to gather all packages I installed. But after developing many days, some packages are now unused.
How can I find these unused packages and remove them, to make my project more clear?
You could open the Glitch terminal and navigate to this directory, and delete all files using the rm command. Be careful, this will remove all packages. Maybe you could use the terminal to just delete the ones you want to remove. This recreates the site-packages folder, for your app to (hopefully) start up again.
The Pip Package Manager can be used to list both globally and locally installed Python packages. The Pipenv, Anaconda Navigator and Conda package managers can also be used to list locally installed packages in their respective environments.
For example, on my system this script eventually failed because the target package had dependencies in common with pip, so pip uninstalled its own dependencies before the script could finish, and then failed. Beware this removes only the next level down dependencies, but not the dependencies of those dependencies.
If the Python installation was done from sources or from Python installation mechanisms (like easy_install or Python setup.py) and not from a packages manager like apt-get or aptitude among others, Python packages are stored under the /usr/local/lib/python<version>/ directory.
Inside Pycharm Go to code > inspect code Select Whole project option and click OK.
In inspection results panel locate Package requirements section under Python (note that this section will be showed only if there is any requirements.txt or setup.py file). The section will contain one of the following messages:
Package requirement '' is not satisfied if there is any package that is listed in requirements.txt but not used in any .py file.
Package '' is not listed in project requirements if there is any package that is used in .py files, but not listed in requirements.txt.
You have all your required packages remove/add them accordingly.
I just found this: https://pypi.python.org/pypi/pip_check_reqs/2.0.
Find packages that should or should not be in requirements for a project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With