Last Updated: February 25, 2016
·
2.134K
· lukasz-madon

Heroku pip problem

I had a problem with deploying one very simple app to Heroku. Here is the error:

-----> Installing dependencies using Pip (1.3.1)
           Exception:
           Traceback (most recent call last):
             File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in mai
    n
               status = self.run(options, args)
             File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 240, i
    n run
               for req in parse_requirements(filename, finder=finder, options=options):
             File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1356, in parse_requ
    irements
               req = InstallRequirement.from_line(line, comes_from)
             File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 96, in from_line
               elif os.path.isdir(path) and (os.path.sep in name or name.startswith('.')):
             File "/app/.heroku/python/lib/python2.7/genericpath.py", line 41, in isdir
               st = os.stat(s)
           TypeError: must be encoded string without NULL bytes, not str

           Storing complete log in /app/.pip/pip.log

     !     Push rejected, failed to compile Python app

Since there is no access to files on Heroku (they are overridden). I fired pip on my local machine to see the log:

C:\Python27\Scripts\pip-script.py run on 10/12/13 02:48:15
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\basecommand.py", line 139, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\commands\install.py", line 240, in run
    for req in parse_requirements(filename, finder=finder, options=options):
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py", line 1356, in parse_requirements
    req = InstallRequirement.from_line(line, comes_from)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py", line 118, in from_line
    return cls(req, comes_from, url=url)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py", line 43, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2510, in parse
    reqs = list(parse_requirements(s))
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2424, in parse_requirements
    raise ValueError("Missing distribution spec", line)
ValueError: ('Missing distribution spec', '\xff\xfeF\x00l\x00a\x00s\x00k\x00=\x00=\x000\x00.\x001\x000\x00.\x001\x00')

seems my requirements.txt file was encoded as UTF and pip wasn't happy about it. Converting to ASCII solves the problem.

2 Responses
Add your response

Hello,
Can you tell me how to convert it because i have the same problem and i cannot solve it
Thanks in advance

over 1 year ago ·

There are dozens ways! you can just open it in Notepad++ and change encoding in menu or you can google how to do it :)

over 1 year ago ·