mycli icon indicating copy to clipboard operation
mycli copied to clipboard

Missing importlib-resources dependency for Python 3.6

Open koallen opened this issue 3 years ago • 3 comments

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

koallen avatar Mar 22 '22 06:03 koallen

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)"

ishaanbhimwal avatar Mar 26 '22 13:03 ishaanbhimwal

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 avatar Mar 26 '22 16:03 koallen

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.

koallen avatar Mar 26 '22 16:03 koallen