How do I fix 'ImportError: cannot import name IncompleteRead'?

前端 未结 16 1166
暖寄归人
暖寄归人 2020-11-28 18:22

When I try to install anything with pip or pip3, I get:

$ sudo pip3 install python3-tk
Tra         


        
相关标签:
16条回答
  • 2020-11-28 19:11

    Check wether you have an older version of requests sitting in your ~/.local/lib/python2.7/site-packages/ and remove it if it is the case (change path to reflect your python version). This solved the issue for me.

    0 讨论(0)
  • 2020-11-28 19:15

    I tried with every answer avobe, but couldn't make it.

    Did this and worked

    sudo apt-get purge python-virtualenv
    sudo pip install pip -U
    

    After that I just installed virtualenv with pip

    sudo pip install virtualenv
    

    I built the virtualenv that I was working on and the package was installed easily. Get into the virtualenv by using source /bin/activate and try to install your package, for example:

    pip install terminado
    

    It worked for me, although I was using python2.7 not python3

    0 讨论(0)
  • 2020-11-28 19:18

    In Windows, this worked from an administrative prompt:

    • Delete C:\Python27\Lib\site-packages\requests*
    • easy_install requests==2.3
    • pip install --upgrade pip
    • pip install --upgrade requests
    0 讨论(0)
  • 2020-11-28 19:22

    This problem is caused by a mismatch between your pip installation and your requests installation.

    As of requests version 2.4.0 requests.compat.IncompleteRead has been removed. Older versions of pip, e.g. from July 2014, still relied on IncompleteRead. In the current version of pip, the import of IncompleteRead has been removed.

    So the one to blame is either:

    • requests, for removing public API too quickly
    • Ubuntu for updating pip too slowly

    You can solve this issue, by either updating pip via Ubuntu (if there is a newer version) or by installing pip aside from Ubuntu.

    0 讨论(0)
提交回复
热议问题