I'm having issues with how `pants repl` interacts ...
# general
p
I'm having issues with how
pants repl
interacts with distribution targets. I have a sample library that depends on
pyyaml
. That library has a target named
lib
which is just a
python_sources
goal and a target named
example_lib
which is a
python_distribution
target. If I do:
Copy code
./pants repl src/example_lib/:lib
everything works fine. But suppose I want a repl with all the libs in my monorepo available. The obvious way to do that would be
./pants repl ::
but that gives me:
Copy code
$ ./pants repl ::
Traceback (most recent call last):
  File "/home/oliver/.pyenv/versions/3.10.0a7/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/oliver/.pyenv/versions/3.10.0a7/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/__main__.py", line 103, in <module>
    bootstrap_pex(__entry_point__, execute=__execute__, venv_dir=__venv_dir__)
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/pex_bootstrapper.py", line 601, in bootstrap_pex
    pex.PEX(entry_point).execute()
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/pex.py", line 519, in execute
    self.activate()
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/pex.py", line 156, in activate
    self._activated_dists = self._activate()
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/pex.py", line 143, in _activate
    activated_dists.extend(env.activate())
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/environment.py", line 321, in activate
    self._activated_dists = self._activate()
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/environment.py", line 671, in _activate
    resolved = self.resolve()
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/environment.py", line 502, in resolve
    for fingerprinted_distribution in self.resolve_dists(all_reqs)
  File "/home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/aa78b3981cc88964a18a80d8fa2d708ffe5155b2/.bootstrap/pex/environment.py", line 589, in resolve_dists
    raise ResolveError(
pex.environment.ResolveError: Failed to resolve requirements from PEX environment @ /home/oliver/.cache/pants/named_caches/pex_root/unzipped_pexes/452071acbd3c0c2b132caf245582cb4d49e6d821.
Needed cp310-cp310-manylinux_2_31_x86_64 compatible dependencies for:
 1: pyyaml
    Required by:
      example-lib 1.0.0
    But this pex had no ProjectName(raw='pyyaml', normalized='pyyaml') distributions.
 2: types-PyYAML
    Required by:
      example-lib 1.0.0
    But this pex had no ProjectName(raw='types-PyYAML', normalized='types-pyyaml') distributions.
Note that the actual built distribution has its dependencies specified correctly:
Copy code
$ tar -O -zxvf dist/example_lib-1.0.0.tar.gz example_lib-1.0.0/setup.py
example_lib-1.0.0/setup.py

# DO NOT EDIT THIS FILE -- AUTOGENERATED BY PANTS
# Target: src/example_lib:example_lib

from setuptools import setup

setup(**{
    'install_requires': (
        'pyyaml',
        'types-PyYAML',
    ),
    'name': 'example_lib',
    'namespace_packages': (
    ),
    'package_data': {
    },
    'packages': (
        'example_lib',
    ),
    'python_requires': '==3.10.*',
    'version': '1.0.0',
})
Is there no way to do a
pants repl
for all libraries in a repo that has one or more distribution targets?
h
That should generally work. I’m wondering if this is an issue with interpreter requirements affecting the resolve. Can you create a trivial github repo that reproduces the problem? That would make figuring this out much easier!
p
@happy-kitchen-89482 thanks for taking a look. Here's a git bundle (https://git-scm.com/book/en/v2/Git-Tools-Bundling) with a small repo that reproduces the issue.
h
I reproduce the problem with this, so will dive in
❤️ 1
👍 1
p
Thanks!
h
Well, to be precise, since I’m running on a macbook m2 I get
Needed cp310-cp310-macosx_12_0_arm64 compatible dependencies
which is similar but not identical
What exact platform are you running this on?
Actually, could you open an issue with all the detail (and link to the repro repo) at https://github.com/pantsbuild/pants/issues ?
So we can track the diagnosis there?
p
will do.
@happy-kitchen-89482 bug filed but Github doesn't want me to attach a .bundle file (they restrict attachments to images, etc.) so I'll just put a link to it via Slack if that's OK. Bug is here: https://github.com/pantsbuild/pants/issues/16985
🙏 1
h
The easiest thing would be a github repo, if you can create one from that bundle
Slack history only lasts for 90 days…
p
will do