pip3 falhando com o ImportError

4

Eu usei o Python v3.5 para codificar com o pacote tensorflow . Agora eu tentei atualizar para a versão mais recente e pip3 caiu o tempo todo com erro seguinte quando eu apenas executar pip3 :

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
    __import__(vendored_name, globals(), locals(), level=0)
ImportError: No module named 'pip._vendor.pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 75, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2976, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2962, in _call_aside
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3004, in _initialize_master_working_set
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2535, in activate
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2109, in declare_namespace
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2058, in _handle_ns
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2078, in _rebuild_mod_path
AttributeError: '_NamespacePath' object has no attribute 'sort'

Estou usando um Ubuntu 16.10 atualizado e não estou ciente de nenhuma alteração de software que possa estar relacionada a esse problema.

FYI: pip , a versão do Python v2.7, funciona sem problemas.

    
por user2729002 23.02.2017 / 17:34

2 respostas

0

Parece que algo quebrou os pacotes do Pip3. Você pode reinstalá-lo com:

sudo apt install --reinstall python3-pip
    
por David Foerster 14.01.2018 / 19:59
-1

Tente atualizar seu pip3 digitando pip3 install --upgrade pip no seu terminal.

EDIT: alterado pip para pip3

    
por Siddharth Dushantha 14.01.2018 / 19:21