Search code examples
pythoninstallationpip

fail to install requirements using "pip install -r requirements.txt"


I'm trying to install packages using "pip install -r requirements.txt" command on bash in Window. Below shows the requirements.txt

Package Version
- - - -  - - - - 
absl-py                      1.0.0
appdirs                      1.4.4
astroid                      2.11.2
astunparse                   1.6.3
audioread                    2.1.9
black                        22.3.0
cachetools                   5.0.0
certifi                      2021.10.8
~~~~                         ~~~~~

However, I got a Error like: ERROR: Invalid requirement: 'Package Version' (from line 1 of requirements.txt)

And then, I tried without first line in requirements.txt, but I got the same error message. How can I handle this problem?


Solution

  • Your requirements.txt should be in the format:

    absl-py==1.0.0
    appdirs==1.4.4
    astroid==2.11.2
    astunparse==1.6.3
    audioread==2.1.9
    black==22.3.0
    cachetools==5.0.0
    certifi==2021.10.8
    

    Use pip freeze > requirements.txt to create/update a requirements.txt file