Why can't install packages with requirements.txt?

Show contents in requirements.txt:

cat  /tmp/requirements.txt
Package           Version
----------------- ---------
alabaster         0.7.8
attrs             20.3.0
Automat           20.2.0
Babel             2.8.0
bcrypt            3.1.7
Brlapi            0.8.2
Brotli            1.1.0
certifi           2020.6.20
chardet           4.0.0

Install it:

pip3   install -r  /tmp/requirements.txt
ERROR: Invalid requirement: 'Package           Version' (from line 1 of /tmp/requirements.txt)

How can install then?

The requirements.txt format is not correct.
Looks like the output of pip list in the format for humans to read.

You can use python -m pip list --format=freeze to get output that can be used as a requirements.txt file.

You can edit the output to remove the versions is they are not required.

1 Like