kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.41k stars 134 forks source link

distutils.errors.DistutilsOptionError when running `pip install argcomplete` on Kali's Python 2.7 #348

Closed tristanlatr closed 3 years ago

tristanlatr commented 3 years ago

Hello, I' m running into this issue when trying to install argcomplete on Kali's Python2.7.

Any help would be much appreciated, thanks!

Full stack trace:

β”Œβ”€β”€(rootπŸ’€0155905a0d19)-[/]
└─# pip install argcomplete
Downloading/unpacking argcomplete
  Downloading argcomplete-1.12.3-py2.py3-none-any.whl
Downloading/unpacking importlib-metadata<5,>=0.23; python_version == "2.7" (from argcomplete)
  Downloading importlib_metadata-4.5.0.tar.gz
  Running setup.py (path:/tmp/pip-build-WVJv6k/importlib-metadata/setup.py) egg_info for package importlib-metadata
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-build-WVJv6k/importlib-metadata/setup.py", line 6, in <module>
        setuptools.setup()
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/__init__.py", line 145, in setup
      File "/usr/lib/python2.7/distutils/core.py", line 124, in setup
        dist.parse_config_files()
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/dist.py", line 702, in parse_config_files
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 116, in parse_configuration
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 426, in parse
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 399, in parse_section
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 184, in __setitem__
      File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 577, in _parse_packages
    distutils.errors.DistutilsOptionError: find_namespace: directive is unsupported on Python < 3.3
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip-build-WVJv6k/importlib-metadata/setup.py", line 6, in <module>

    setuptools.setup()

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/__init__.py", line 145, in setup

  File "/usr/lib/python2.7/distutils/core.py", line 124, in setup

    dist.parse_config_files()

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/dist.py", line 702, in parse_config_files

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 116, in parse_configuration

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 426, in parse

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 399, in parse_section

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 184, in __setitem__

  File "/usr/share/cffi-wheels/setuptools-44.1.0-py2.py3-none-any.whl/setuptools/config.py", line 577, in _parse_packages

distutils.errors.DistutilsOptionError: find_namespace: directive is unsupported on Python < 3.3

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-WVJv6k/importlib-metadata
Storing debug log for failure in /root/.pip/pip.log
kislyuk commented 3 years ago

Thanks for reporting. It looks like you are using Python 2.7, which is no longer supported. Please upgrade to Python 3.

tristanlatr commented 3 years ago

@kislyuk Yes I'm using python2.7 because some software are not ported to python3 and probably never will be.

I would be very surprised if Red Hat removes python2.7 from their distribution within the next 10 years, so it's still really alive to me! Also your setup.py state that python 2.7 is supported by this package, this is why I opened this issue :-)

Thanks for your help!

tristanlatr commented 3 years ago

If I understand correctly, this: (in the setup.py)

packages=find_packages(exclude=['test']),

Is not supported by Python2.7.

I believe, this would work exactly the same and will be compatible with python2.7

packages=['argcomplete'],

Tell me what you think @kislyuk .

Thanks

kislyuk commented 3 years ago

The error that you see actually comes from a dependency of argcomplete called importlib-metadata. You can install an older version of that package that is compatible with Python 2.7 to avoid this issue. A quick check indicates that version 2.1.1 is the last version of that library compatible with Python 2.7: https://pypi.org/project/importlib-metadata/2.1.1/ so you can pip install importlib-metadata==2.1.1 followed by pip install argcomplete and it should work.

While we won't go out of our way to drop existing Python 2.7 support yet, we also will not make any effort to support it. So nothing will be done to accommodate Python 2.7 specific issues at this point.