執行 pip install docker 時遇到 dnspython 和 python-ldap 錯誤



Question: 執行 pip install docker 指令時遇到 dnspython 和 python-ldap 錯誤?

執行 pip install docker 指令時,遇到如下顯示 dnspython python-ldap 錯誤訊息?


ERROR: ipapython 4.6.5 has requirement dnspython>=1.15, but you'll have dnspython 1.12.0 which is incompatible.
ERROR: ipapython 4.6.5 has requirement python-ldap>=3.0.0b1, but you'll have python-ldap 2.4.15 which is incompatible.
ERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.



Answer:

執行「pip install -l requests==2.9」指令修正 requests 套件問題後,即可順利執行 pip install docker 指令。


後續重新安裝時,發現還是會有相關套件相依性的問題,因此,請依照下列先處理相關套件最後就能順利執行 pip install docker 指令。
$ sudo pip install -I requests==2.9  --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org
$ sudo pip install python-ldap --user -U --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org
$ sudo pip install dnspython --user -U --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org
$ sudo pip install cffi --user -U --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org
$ sudo pip install docker  --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org