user3796109 user3796109 - 2 months ago 33x
Python Question

No module named pip.req

I am installing tweepy, but I am running into an error about pip.req. I have pip installed, but for some reason pip.req still can't be found. I did a bunch of research online and the most I could find was some issue about incompatibilities between zapo (?) and python 2.7 causing the same error for some other user. The discussion was unclear about how to solve the problem, though. Thanks!

$ python2 install
Traceback (most recent call last):
File "", line 5, in <module>
from pip.req import parse_requirements
ImportError: No module named pip.req


It looks like it would work if you had this code:

def parse_requirements(filename):
    """ load requirements from a pip requirements file """
    lineiter = (line.strip() for line in open(filename))
    return [line for line in lineiter if line and not line.startswith("#")]

Do this:

  1. create a directory pip/
  2. add an empty file pip/
  3. add a file pip/
  4. put the code above into pip/
  5. modify the line in

    reqs = install_reqs