1

I have done nothing, and everything is broken.

aviv$ python3 -c 'import setuptools'
Traceback (most recent call last):
  File "/usr/lib/python3.5/pkgutil.py", line 407, in get_importer
importer = sys.path_importer_cache[path_item]
KeyError: ''

This means that pip is broken and airflow is broken. Everything is broken. Please help.

EDIT: It was suggested that this is a duplicate of this question: Python 3: ImportError "No Module named Setuptools". I'm doing a different thing and getting a different error than what's going on in that question, and I've also removed and reinstalled python3-setuptools with the latest version available. Still getting the same error.

EDIT 2: Full traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.5/pkgutil.py", line 407, in get_importer
    importer = sys.path_importer_cache[path_item]
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 11, in <module>
    from setuptools.extern.six.moves import filterfalse, map
  File "/usr/lib/python3/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 626, in _build_master
    ws = cls()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 619, in __init__
    self.add_entry(entry)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 675, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1929, in find_distributions
    importer = get_importer(path_item)
  File "/usr/lib/python3.5/pkgutil.py", line 411, in get_importer
    importer = path_hook(path_item)
  File "<frozen importlib._bootstrap_external>", line 1303, in path_hook_for_FileFinder
  File "<frozen importlib._bootstrap_external>", line 95, in _path_isdir
FileNotFoundError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 67, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwd(), sys.argv[0]))
FileNotFoundError: [Errno 2] No such file or directory

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3.5/pkgutil.py", line 407, in get_importer
    importer = sys.path_importer_cache[path_item]
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 11, in <module>
    from setuptools.extern.six.moves import filterfalse, map
  File "/usr/lib/python3/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
    from pkg_resources.extern import VendorImporter
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 626, in _build_master
    ws = cls()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 619, in __init__
    self.add_entry(entry)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 675, in add_entry
    for dist in find_distributions(entry, True):
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1929, in find_distributions
    importer = get_importer(path_item)
  File "/usr/lib/python3.5/pkgutil.py", line 411, in get_importer
    importer = path_hook(path_item)
  File "<frozen importlib._bootstrap_external>", line 1303, in path_hook_for_FileFinder
  File "<frozen importlib._bootstrap_external>", line 95, in _path_isdir
FileNotFoundError: [Errno 2] No such file or directory
Aviv Goldgeier
  • 799
  • 7
  • 23

1 Answers1

13

Found the answer — it's really stupid.

I was trying to run everything from a directory that no longer existed. os.getcwd() itself was erroring out. Changed directories, ran again, works now.

Aviv Goldgeier
  • 799
  • 7
  • 23
  • 1
    Funny I had found an expired [Fedora bug](https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=1534676) before writing my comment but I didn't even think this could be your case too. – Stop harming Monica Jan 31 '19 at 20:02
  • +1. so hard explanation in the generated output message. Why they can not just say the root of the problem in a single line plain English... Thanks! – Arsen Feb 06 '21 at 14:06