Install pip module: ImportError: No module named pip.req

  • A+
  1. Installation of pip using is breaking. it saysRequirement already up-to-date: pip in /tmp/tmpvF6RoH/ (10.0.0)
  2. No module named pip.req

while installing a pip module

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



For installation using use the --force-reinstall flag:

$ python --force-reinstall 

Obviously this is till they fix the problem

Imports from pip

If you have any imports from pip, such as:

try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements


Now that said it's not a good practice to use the internal pip functions, due to multiple reasons as mentioned here:


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: