I'm facing a setupgen plugin related issue on pant...
# plugins
r
I'm facing a setupgen plugin related issue on pants 2.21.0.dev4 (upgraded to an in-dev version for Python 3.12 support with https://github.com/pantsbuild/pants/pull/20365) when I try to build wheels. It seems to be an issue arising from an old version of setuptools as I found a mention that says setuptools 66.1+ has resolved this deprecated import of
pkgutil.ImpImporter
. Could somebody help me to make my pants & setupgen plugin to use a more recent version of setuptools?
Copy code
> pants --tag="wheel" package src/ai/backend/manager::
03:28:47.81 [INFO] Initializing scheduler...
03:28:50.82 [INFO] Scheduler initialized.
...
03:28:53.52 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Run setuptools.build_meta:__legacy__ for src/ai/backend/manager:dist' failed with exit code 1.
stdout:

stderr:
Traceback (most recent call last):
  File "/tmp/bai-edge-MIARjAJAf4jpNbTN-pants/pants-sandbox-xT6MSI/chroot/../.cache/pex_root/venvs/20d1a575d196d07d994ae38dc2077e2bd23a933c/12bdfbbbf401f710ce88941330fde74cd65f6c1c/pex", line 311, in <module>
    exec(ast, globals_map, locals_map)
  File "backend_shim.py", line 6, in <module>
    import setuptools.build_meta
  File "/home/joongi/.cache/pants/named_caches/pex_root/venvs/s/d42a92f1/venv/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/home/joongi/.cache/pants/named_caches/pex_root/venvs/s/d42a92f1/venv/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/home/joongi/.cache/pants/named_caches/pex_root/venvs/s/d42a92f1/venv/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
1
h
You can update the setuptools version Pants uses by following the instructions for generating a tool lockfile
r
@happy-kitchen-89482 hmm... We are already using per-tool resolve-based lockfiles, and I've put
setuptools>=69.2
in
requirements.txt
but no gain.
h
And you regenerated the lockfile, presumably?
r
yes
should i update all requirements.txt exhaustively as i have multiple of them? what about pants plugin requirements?
i tried to put it in all requirements file but still no difference.. all requirements.txt referred in https://github.com/lablup/backend.ai/blob/main/tools/BUILD and the root’s requirements.txt
h
You should only need to update setuptools's lockfile
So hmmm
r
ah…. can i define a tool for setuptools?;
how do i control the setuptools version used for
generate_setup = True
?
h
It's that tool
you follow the instructions for generating a custom tool lockfile, for the
setuptools
scope
👀 1
v
I am on a same boat with him and was able to sort out this issue (reference) with your guidance. Thanks! @happy-kitchen-89482
👍 1
h
Great!
🙌 1
r
great! Just curious: is there any other tool that work as an implicit internal dependency set like setuptools? @happy-kitchen-89482
or is there some generic mechanism that pants incorporates explicitly defined resolves as the internal backend dependency?
h
What do you mean by "implicit"? Pants treats setuptools the same way it treats pytest or mypy or whatever