mammoth-truck-89764
07/09/2024, 2:06 PMpants update-build-files :: --keep-sandboxes=on_failure
But I get — full in 🧵
File "/private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN/.tmp/tmp9vgfsmgq/.bootstrap/pex/compatibility.py", line 131, in <module>
from urllib.request import HTTPSHandler as HTTPSHandler
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (/Users/jleung/.pyenv/versions/3.8.5/lib/python3.8/urllib/request.py)
What I’ve tried…
1. I’ve verified that openssl@3
is properly installed
2. Reading through https://github.com/pantsbuild/pants/issues/20380…
a. Tried adding LD_LIBRARY_PATH
to pants.toml, but this is not regularly set in my non-pants env anyway
b. So I tried adding LDFLAGS
instead; no dice either.
c. Adding these to subprocess-environment does not seem to impact the sandbox/__run.sh
generated, which I’m confused by.
3. Inspected the sandbox/__run.sh
contents — copy in 🧵
a. I see that LDFLAGS
points to where libssl
is
b. I see that --python-path
for pex
includes where openssl
the binary lives.
c. I see that the interpreter-constraint is different than the one I specified in pants.toml
and don’t really understand why. I have specified interpreter_constraints = ["==3.10.*"]
— although I read somewhere that the python interpreter used for pants-build vs pants-execution-env are different
d. The sandbox’s .tmp
gets garbage collected (even with --keep-sandboxes
, although I see in the stack trace it once existed
Help!mammoth-truck-89764
07/09/2024, 2:06 PM09:30:30.01 [INFO] Preserving local process execution dir /private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN for Find interpreter for constraints: CPython<4,>=3.7
09:30:30.01 [ERROR] 1 Exception encountered:
Engine traceback:
in Update all BUILD files
ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython<4,>=3.7' failed with exit code 1.
stdout:
stderr:
Traceback (most recent call last):
File "/Users/jleung/.pyenv/versions/3.8.5/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/jleung/.pyenv/versions/3.8.5/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN/.tmp/tmp9vgfsmgq/__main__.py", line 91, in <module>
from pex.variables import ENV, Variables
File "/private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN/.tmp/tmp9vgfsmgq/.bootstrap/pex/variables.py", line 20, in <module>
from pex.orderedset import OrderedSet
File "/private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN/.tmp/tmp9vgfsmgq/.bootstrap/pex/orderedset.py", line 15, in <module>
from pex.compatibility import MutableSet
File "/private/var/folders/_r/bpx48g8n0gx04jclzq9g8cnc0000gn/T/pants-sandbox-dX2miN/.tmp/tmp9vgfsmgq/.bootstrap/pex/compatibility.py", line 131, in <module>
from urllib.request import HTTPSHandler as HTTPSHandler
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (/Users/jleung/.pyenv/versions/3.8.5/lib/python3.8/urllib/request.py)
mammoth-truck-89764
07/09/2024, 2:06 PMenv -i CPPFLAGS=-I/opt/homebrew/include LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LDFLAGS=-L/opt/homebrew/lib PATH=$'/Users/jleung/Code/google-cloud-sdk/bin:/Users/jleung/.pyenv/shims:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/iTerm.app/Contents/Resources/utilities' PEX_IGNORE_RCFILES=true PEX_PYTHON=/Users/jleung/Library/Caches/nce/6faa4322d1df41d032e4938795c6f2c262ab92bb642a9bac1101cb7d1631f9c1/bindings/venvs/2.21.0/bin/python3.9 PEX_ROOT=.cache/pex_root /Users/jleung/Library/Caches/nce/6faa4322d1df41d032e4938795c6f2c262ab92bb642a9bac1101cb7d1631f9c1/bindings/venvs/2.21.0/bin/python3.9 ./pex --tmpdir .tmp --no-emit-warnings --pip-version 24.0 --python-path $'/Users/jleung/.pyenv/versions/3.10.14/bin:/Users/jleung/.pyenv/versions/3.11.9/bin:/Users/jleung/.pyenv/versions/3.8.5/bin:/Users/jleung/.pyenv/versions/scratch/bin:/Users/jleung/Code/google-cloud-sdk/bin:/Users/jleung/.pyenv/shims:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/iTerm.app/Contents/Resources/utilities' --interpreter-constraint $'CPython<4,>=3.7' -- -c $'import hashlib, os, sys\n\npython = os.path.realpath(sys.executable)\nprint(python)\n\nhasher = hashlib.sha256()\nwith open(python, "rb") as fp:\n for chunk in iter(lambda: fp.read(8192), b""):\n hasher.update(chunk)\nprint(hasher.hexdigest())\n'
broad-processor-92400
07/10/2024, 2:53 AMpants.toml
file too? (or at least, as much as can be public)mammoth-truck-89764
07/11/2024, 1:36 PM[GLOBAL]
pants_version = "2.21.0"
backend_packages.add = [
"pants.backend.python",
"pants.backend.python.lint.docformatter",
"pants.backend.python.lint.autoflake",
"pants.backend.python.lint.black",
"pants.backend.python.lint.flake8",
"pants.backend.python.lint.isort",
"pants.backend.python.typecheck.mypy",
"pants.backend.docker",
]
[source]
root_patterns = ["/"]
[python]
interpreter_constraints = ["==3.10.*"]
enable_resolves = true
resolves = { python-default = "python-default.lock"}
[python-bootstrap]
search_path = ["<PATH>", "<PYENV>"]
[python-infer]
string_imports = true
[pytest]
install_from_resolve = "python-default"
requirements = ["pytest-django"]
execution_slot_var = "PANTS_EXECUTION_SLOT"
[mypy]
install_from_resolve = "python-default"
requirements = ["django-stubs[compatible-mypy]"]
[docker]
use_buildx=true
env_vars = [
"BUILDX_BUILDER=container"
]
broad-processor-92400
07/11/2024, 11:00 PM