Search code examples
pythonpip

List Only main Packages with pip list


With pip list, we can see the install packages in our environment. There is no problem with that. We can also write them to a req.txt file with pip freeze and quickly load them in other environments with this req.txt file. My question here is, for example, when we install pandas, libraries such as numpy are installed with them, and we can see other libraries installed outside of pandas with pip list. Can I use an option with pip list to see only the main libraries I have installed here? For example, is there an option to show only pandas (no libraries like numpy) when I do a pip list?


Solution

  • You can use --not-required flag. This will list packages that are not dependencies of installed packagespip.pypa.io.

    python -m pip list --not-required
    

    or if pip is in $PATH

    pip list --not-required