Skip to main content
1 of 2
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

Assuming all the required packages are installed on your Debian system, asking pip to freeze the requirements again will update them to match the installed packages:

pip freeze --requirement requirements.txt | sed '/^\s*#.*pip freeze/,$ d' > new-requirements.txt

You can then check new-requirements.txt and replace requirements.txt with it if everything’s OK.

The sed filter is used to remove potentially transitive dependencies added by pip.

Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k