https://pantsbuild.org/ logo
#general
Title
# general
f

freezing-area-97131

08/01/2022, 4:50 PM
Hi, I am using this very old pants
1.17.0
. Recently I got dependency issue when building the pex.
Copy code
...
import attr
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/__init__.py", line 8, in <module>
    from . import converters, exceptions, filters, setters, validators
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/converters.py", line 10, in <module>
    from ._compat import _AnnotationExtractor
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/_compat.py", line 11, in <module>
    from collections.abc import Mapping, Sequence  # noqa
ImportError: No module named abc
I have investigated and find out the error comes from the package attrs , it recently updated and not supports python 2.7 anymore, so I have to peg its version to previous one
21.4.0
I have set the
BUILD
file like this:
Copy code
python_requirement_library(
    name='attrs',
    requirements=[
        python_requirement(name='attrs', requirement='attrs==21.4.0'),
    ],
    dependencies=[
        ':coverage',
    ],
)
But when I run test or build pex, I still got the same error, and when I look into the
.pants.d/python-setup/resolved_requirements/CPython-2.7.12/
, there is still
attrs-22.1.0-py2.py3-none-any.whl
installed, not the
21.4.0
What should I do ? Can anyone help me~? Thanks a lot!