No module named pip.req
This is happening lately because of a change in pip 10.
The fix is pretty easy. You probably have something like:
from pip.req import parse_requirements
Change that to something like:
try: # for pip >= 10 from pip._internal.req import parse_requirementsexcept ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements
That should do it.
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:
- create a directory
pip/
- add an empty file
pip/__init__.py
- add a file
pip/req.py
- put the code above into
pip/req.py
: modify the line in
setup.py
reqs = install_reqs