dbcli / mycli

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.
http://mycli.net
Other
11.49k stars 663 forks source link

Missing importlib-resources dependency for Python 3.6 #1036

Open koallen opened 2 years ago

koallen commented 2 years ago

pip installing this under Python 3.6 and running mycli will lead to the following error,

Traceback (most recent call last):
  File "...../lib64/python3.6/site-packages/mycli/config.py", line 14, in <module>
    import importlib.resources as resources
ModuleNotFoundError: No module named 'importlib.resources'

Installing the importlib-resources library separately fixes the issue. We need to list this as a dependency for Python 3.6

ishaanbhimwal commented 2 years ago

Couldn't find any reason on why it won't auto-install importlib-resources when installing with pip. mycli/setup.py contains these lines:

install_requirements = [
    'click >= 7.0',
    'cryptography >= 1.0.0',
    # 'Pygments>=1.6,<=2.11.1',
    'Pygments>=1.6',
    'prompt_toolkit>=3.0.6,<4.0.0',
    'PyMySQL >= 0.9.2',
    'sqlparse>=0.3.0,<0.5.0',
    'configobj >= 5.0.5',
    'cli_helpers[styles] >= 2.2.1',
    'pyperclip >= 1.8.1',
    'pyaes >= 1.6.1'
]

if sys.version_info.minor < 9:
    install_requirements.append('importlib_resources >= 5.0.0')

Can you share the output of the following commands:

python --version
python -c "import sys; print(sys.version_info.minor)"
koallen commented 2 years ago

I verified sys.version_info.minor is 6.

That conditional doesn't work because by default the wheel gets installed, and I think whatever machine you are using to build the wheel is not using Python 3.6 so it doesn't list import_resources as a dep.

If I do pip install mycli --no-binary mycli then it correctly installs import_resources.

koallen commented 2 years ago

I'm not a Python packaging expert, but a quick Google search suggests you may need something like https://peps.python.org/pep-0508/#environment-markers to make Python 3.6 work with wheels.