Installation of pip using get-pip.py is breaking. it says
Requirement already up-to-date: pip in /tmp/tmpvF6RoH/pip.zip (10.0.0)
No module named pip.req
while installing a pip module
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from pip.req import parse_requirements
ImportError: No module named pip.req
Installation
For installation using get-pip.py use the --force-reinstall flag:
Obviously this is till they fix the problem https://github.com/pypa/pip/issues/5220
Recommended Alternative to pip's internal commands
Avoid putting any dependency links in your
requirements.txt
file. Instead use the method mentioned below. You can directly put the dependency links in yousetup.py
file. Some famous packages also maintain the requirements inside thesetup.py
file in the form of a list and don't have anyrequirements.txt
fileImports from pip (BAD PRACTICE - DO NOT USE as it may break anytime! )
It is highly recommended that you avoid this because, as mentioned in the pip user guide, these methods are not thread safe. Also since they're pip's private methods, they may change it anytime without any prior notice, thereby breaking your package installation!
If you have any imports from pip, such as:
it'll break. Since these have been now moved to pip._internal as such:
However effectively you'll have to use something like this for backward compatibility:
Important
Now that said it's not a good practice to use the internal pip functions, due to multiple reasons as mentioned here: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program