Does anyone recognise: `ModuleNotFoundError: No mo...
# development
a
Does anyone recognise:
ModuleNotFoundError: No module named 'pants.bin'
when trying to build a cross-platform pex of pants? Running
PANTS_PEX_RELEASE=STABLE ./build-support/bin/release.sh build-universal-pex
at 2.8.0.dev5 I'm getting:
Copy code
[=== 00:44 Checking prebuilt wheels for 2.8.0.dev5+git3ee3288e ===]
All 2 pantsbuild.pants packages were fetched and are valid.
/Users/dwh/.cache/pants/named_caches/pex_root/installed_wheels/a62f822b62a14ee4072eb45dc8505f01ca805f7b/pex-2.1.51-py2.py3-none-any.whl/pex/commands/command.py:412: PEXWarning: The pex root has been set via PEX_ROOT but --disable-cache is also set. Ignoring PEX_ROOT and disabling caches.
  "Ignoring {via} and disabling caches.".format(via=set_via)
Built /Users/dwh/src/github.com/pantsbuild/pants/dist/deploy/pex/pants.2.8.0.dev5.pex
Traceback (most recent call last):
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 476, in execute
    exit_value = self._wrap_coverage(self._wrap_profiling, self._execute)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 401, in _wrap_coverage
    return runner(*args)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 432, in _wrap_profiling
    return runner(*args)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 532, in _execute
    return self.execute_entry(self._pex_info.entry_point)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 668, in execute_entry
    return self.execute_pkg_resources(entry_point)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/pex.py", line 699, in execute_pkg_resources
    runner = entry.resolve()
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/6fc821a7c78f8fce0d8ae58c091013a1d21db5c8/.bootstrap/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py", line 2481, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'pants.bin'
Traceback (most recent call last):
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 476, in execute
    exit_value = self._wrap_coverage(self._wrap_profiling, self._execute)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 401, in _wrap_coverage
    return runner(*args)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 432, in _wrap_profiling
    return runner(*args)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 532, in _execute
    return self.execute_entry(self._pex_info.entry_point)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 679, in execute_entry
    return self.execute_module(entry_point, alter_sys)
  File "/Users/dwh/.cache/pants/named_caches/pex_root/unzipped_pexes/b9fbddc60b329b36bd6656142ccba79f43ae4b6e/.bootstrap/pex/pex.py", line 691, in execute_module
    runpy.run_module(module_name, run_name="__main__", alter_sys=alter_sys)
  File "/usr/local/Cellar/python@3.7/3.7.12_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/Cellar/python@3.7/3.7.12_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/local/Cellar/python@3.7/3.7.12_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/dwh/src/github.com/pantsbuild/pants/.pants.d/tmpyxyw4scb/build-support/bin/_release_helper.py", line 1121, in <module>
    main()
  File "/Users/dwh/src/github.com/pantsbuild/pants/.pants.d/tmpyxyw4scb/build-support/bin/_release_helper.py", line 1107, in main
    build_pex(fetch=True)
  File "/Users/dwh/src/github.com/pantsbuild/pants/.pants.d/tmpyxyw4scb/build-support/bin/_release_helper.py", line 732, in build_pex
    subprocess.run([sys.executable, str(dest), "--version"], check=True)
  File "/usr/local/Cellar/python@3.7/3.7.12_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/local/opt/python@3.7/bin/python3.7', '/Users/dwh/src/github.com/pantsbuild/pants/dist/deploy/pex/pants.2.8.0.dev5.pex', '--version']' returned non-zero exit status 1.
e
No. Can you share the PEX contents? Perhaps start with the PEX-INFO.
Ok - I repro. That said, running the failing command listed works. Looking...
Yeah - this is artificial. I'll post a PR shortly to fix this going forward, but the pex you built is just fine and can be uploaded.
a
Fabulous, thanks!