Invalid requirement: 'pip freeze > requirements.txt'

Hi, I’ve built a page of dash dashboard installed on an Alicloud GPU ubuntu 16.04 nstance and wanna share the URL.

I’m following the instruction on https://dash.plot.ly/deployment/ and running smoothly until “git push heroku master”

Here is the error code:
{
-----> Python app detected
-----> Installing python-3.6.6
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
Invalid requirement: ‘pip freeze > requirements.txt’
Traceback (most recent call last):
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py”, line 92, in init
req = REQUIREMENT.parseString(requirement_string)
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 1617, in parseString
raise exc
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 1607, in parseString
loc, tokens = self._parse( instring, 0 )
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 3376, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File “/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py”, line 3164, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 4), (line:1, col:5)

   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_install.py", line 82, in __init__
       req = Requirement(req)
     File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
       requirement_string[e.loc:e.loc + 8]))
   pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'freeze >'"

! Push rejected, failed to compile Python app.
! Push failed
}

I’ve been googling around for solutions but seem no one encountering the same issue. Does anyone have some clue on the issue?

heroku version 7.7.4, not the up-to-date one.

Check your requirements.txt file, it looks like there is a typo in there

Did you find out what the typo was, as pointed out by chriddyp? I ran into the exact same issue. Thank!

pip freeze is a subcommand of pip, it helps you generate the txt file, there is no need to include that in it

1 Like

i am getting the same error and have no idea what to do…

> 
> remote:        
> remote:        During handling of the above exception, another exception occurred:
> remote:        
> remote:        Traceback (most recent call last):
> remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/req/req_install.py", line 82, in __init__
> remote:            req = Requirement(req)
> remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
> remote:            requirement_string[e.loc:e.loc + 8]))
> remote:        pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'$ pip fr'"
> remote:        
> remote:  !     Push rejected, failed to compile Python app.

i tried to tweak here and there but without success… if anyone could help me, i would be grateful

@nirvikalpa @chaintech it looks like you may have typed “pip freeze > requirements.txt” in your requirements.txt file. Create the requirements.txt file and leave it blank. Then, type " pip freeze > requirements.txt" into your command line. It will auto populate your requirements.txt file. This should work.