hey team, I am seeing Pants giving me errors when ...
# general
f
hey team, I am seeing Pants giving me errors when I use version
2.7.0
or
2.7.1
instead of
2.6.1
. It may be related to https://pantsbuild.slack.com/archives/C046T6T9U/p1634120386065100?thread_ts=1634114532.062500&cid=C046T6T9U.
This is the error I get when running
./pants package my-project::
(both on a MacOS and Linux device):
Copy code
UndefinedEnvironmentName: 'platform_machine' does not exist in evaluation environment.
pid 30314 -> /Users/username/.cache/pants/named_caches/pex_root/venvs/1d2a3f1b3961efbfba4c4373717c72d09d116d95/6a77fa4c4cb26ace625186dd39a1df03b7dc2d73/pex --disable-pip-version-check --no-python-version-warning --exists-action a --use-feature 2020-resolver --isolated -q --cache-dir /Users/username/.cache/pants/named_caches/pex_root --log /private/var/folders/k0/3nssm8v15r5b08k1k1wyhs2r0000gp/T/process-executionr3ZLCK/.tmp/tmpPQBi1j/pip.log download --dest /private/var/folders/k0/3nssm8v15r5b08k1k1wyhs2r0000gp/T/process-executionr3ZLCK/.tmp/tmpcD5DZQ/linux_x86_64-cp-38-cp38 --platform manylinux2014_x86_64 --platform linux_x86_64 --implementation cp --python-version 38 --abi cp38 --only-binary :all: --constraint constraints.txt dataclasses==0.6 pandas>=1.0 requests>=2.22 --index-url <https://my-hosted-pypi/pypi/simple> --extra-index-url <https://pypi.python.org/simple> --retries 5 --timeout 15 exited with 2 and STDERR:
None
I have experimented removing some of the requirements, but the error keeps manifesting with other packages, this seems to be arbitrary (I wasn’t able to tie it to a particular PyPI package, and SQLAlchemy has been removed as well). What information would one want to see to understand the problem better?
Not sure if I’ve seen
python2.7
in outputs of PEX before (it’s not Pants 2.7, right?):
Copy code
stderr:
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/commands/download.py", line 131, in run
    reqs, check_supported_wheels=True
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 347, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 198, in _get_criteria_to_update
    for r in self._p.get_dependencies(candidate):
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 172, in get_dependencies
    for r in candidate.iter_dependencies(with_requires)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 247, in iter_dependencies
    requires = self.dist.requires() if with_requires else ()
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2736, in requires
    dm = self._dep_map
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3040, in _compute_dependencies
    common = frozenset(reqs_for_extra(None))
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3037, in reqs_for_extra
    if not req.marker or req.marker.evaluate({'extra': extra}):
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/packaging/markers.py", line 328, in evaluate
    return _evaluate_markers(self._markers, current_environment)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/packaging/markers.py", line 244, in _evaluate_markers
    lhs_value = _get_env(environment, lhs.value)
  File "/Users/username/.cache/pants/named_caches/pex_root/venvs/short/a09ac147/lib/python2.7/site-packages/pip/_vendor/packaging/markers.py", line 225, in _get_env
    "{0!r} does not exist in evaluation environment.".format(name)
UndefinedEnvironmentName: 'platform_machine' does not exist in evaluation environment.
...
e
As it turns out I'm backporting modern Pex to the 2.7.x and 2.8.x branches to fix https://github.com/pantsbuild/pants/issues/13451 so you'll get the
platform_machine
fix that went into Pex 2.1.52 here soon in 2.7.2rc0 and 2.8.0rc2: https://github.com/pantsbuild/pex/releases/tag/v2.1.52
f
this is amazing, thank you so much @enough-analyst-54434! Please let me know if you need to test anything. Many thanks.
e
@fresh-cat-90827 you should be good to go with one of these releases: https://pantsbuild.slack.com/archives/C18RRR4JK/p1635968658005300 If you can test and report back, that would be great.
f
amazing, thank you @enough-analyst-54434!
I don’t any longer get the
platform_machine
error in
2.8.0rc5
! Thanks a ton for fixing this, @enough-analyst-54434