1

After creating a clean environment with mamba pinning the python version and installing pylint, I get an apparent incompatibility between the pylint and python versions. Is this a bug in the package requierements?

In Linux, I have created a mamba environment with:

mamba create -n py_36_dev_generic python=3.6
mamba activate py_36_dev_generic
mamba install pylint pycodestyle pydocstyle

Then when I run pylint:

python -m pylint

I get the following error:

Traceback (most recent call last):
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/pylint/__init__.py", line 21, in run_pylint
    from pylint.lint import Run as PylintRun
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/pylint/lint/__init__.py", line 76, in <module>
    from pylint.lint.parallel import check_parallel
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/pylint/lint/parallel.py", line 9, in <module>
    from pylint.lint.utils import _patch_sys_path
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/pylint/lint/utils.py", line 10, in <module>
    from pylint.config import PYLINT_HOME
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/pylint/config/__init__.py", line 43, in <module>
    import platformdirs
  File "/home/johndoe/mambaforge/envs/py_36_dev_generic/lib/python3.6/site-packages/platformdirs/__init__.py", line 5
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

Other SA similar questions seem to point to the fact that python 3.6 is not compatible with __future__. However this incompatibility does not seem to be reflected in the conda-forge package requirements:

  • According to mamba list | grep pylint, the installed version of pylint 2.11.1
  • According to mamba info pylint=2.11.1, pylint depends on platformdirs >=2.2.0
  • According to mamba list | grep platformdirs , the installed version of platformdirs is2.5.1
  • According to mamba info platformdirs=2.5.1 | grep python, the requiered python is python >=3.6

Does this mean this is a bug in the conda-forge's platformdirs package requirements?

Is there any easy workaround or fix inside mamba (without needing to manually install a package from git or switching to pip)?

darmual
  • 229
  • 3
  • 7
  • 1
    `from __future__ import annotations` was added in Python 3.7. https://peps.python.org/pep-0563/ "This change is being introduced gradually, starting with a `__future__` import in Python 3.7." According to platformdirs pypi page for 2.5.1, it requires Python >=3.7 - https://pypi.org/project/platformdirs/3.5.1/ - this suggest that mamba has wrong req for the package. – h4z3 Aug 02 '23 at 12:38
  • 1
    The conda-forge metadata appears to be wrong - platformdirs 2.5.1 [lists](https://github.com/platformdirs/platformdirs/blob/2.5.1/setup.cfg#L34) a minimum Python version of 3.7 in its setup.cfg, contrary to what conda-forge says. – user2357112 Aug 02 '23 at 12:43
  • 1
    According to pypi, last version of platformdirs that supports 3.6 should be 2.4.0. The support was dropped (or at least metadata about supported versions was updated) with 2.4.1. – h4z3 Aug 02 '23 at 12:45
  • 1
    Yep, Conda Forge metadata is wrong. This was previously reported, but nobody fixed it: https://github.com/conda-forge/platformdirs-feedstock/issues/14. Feel free to patch it - maintainer said that Python 3.6 is too old to bother, but PRs are always welcome. – merv Aug 03 '23 at 14:51

0 Answers0