aloof-appointment-30987
12/14/2022, 6:10 PM./nectl/neuroedge_cli/BUILD
python_sources(name = "neuroedge_cli")
pex_binary(
name = "nectl",
dependencies = [":neuroedge_cli"],
entry_point = "./nectl.py",
)
If I run
./pants run nectl/neuroedge_cli/nectl.py
Everything is fine. If I instead run
./pants run nectl/neuroedge_cli:nectl
It fails with:
12:58:13.40 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Building nectl.neuroedge_cli/nectl.pex with 10 requirements: click==8.1.3, dvg-ringbuffer==1.0.3, keyring==23.5.1, numba==0.56.0, numpy==1.22.4, pandas~=1.4, requests==2.25.1, rich==12.4.1, scipy==1.8.1, tables==3.7.0' failed with exit code 1.
stdout:
stderr:
pid 28706 -> /Users/russellzarse/.cache/pants/named_caches/pex_root/venvs/cac1718c056bb509f51fcdcc0c376b33deaaa8ec/e6831f8bef1e0125d178dbca2c603370d4eeae8a/bin/python -sE /Users/russellzarse/.cache/pants/named_caches/pex_root/venvs/cac1718c056bb509f51fcdcc0c376b33deaaa8ec/e6831f8bef1e0125d178dbca2c603370d4eeae8a/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /Users/russellzarse/.cache/pants/named_caches/pex_root/pip_cache --log /private/var/folders/_d/zt8y2x055597l63bhdztp82c0000gn/T/pants-sandbox-8W6RvT/.tmp/pex-pip-log.ooax9v3d/pip.log download --dest /Users/russellzarse/.cache/pants/named_caches/pex_root/downloads/resolver_download.hetwm61n/usr.local.Cellar.python@3.11.3.11.0.Frameworks.Python.framework.Versions.3.11.bin.python3.11 click==8.1.3 dvg-ringbuffer==1.0.3 keyring==23.5.1 numba==0.56.0 numpy==1.22.4 pandas~=1.4 requests==2.25.1 rich==12.4.1 scipy==1.8.1 tables==3.7.0 --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
WARNING: Discarding <https://files.pythonhosted.org/packages/b3/23/fd8e7aa70f6c0b41c99de6aae7afc6850ebac2477687e68c6529bfaa41ba/numba-0.56.0.tar.gz#sha256=87a647dd4b8fce389869ff71f117732de9a519fe07663d9a02d75724eb8e244d> (from <https://pypi.org/simple/numba/>) (requires-python:>=3.7). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement numba==0.56.0
ERROR: No matching distribution found for numba==0.56.0
If I add interpreter_constraints
to the pex_binary
target
pex_binary(
name = "nectl",
interpreter_constraints=['CPython==3.8.*'],
dependencies = [":neuroedge_cli"],
entry_point = "./nectl.py",
)
run succeed. However...
pex_binary(
name = "nectl",
interpreter_constraints=['CPython>=3.8,<4'],
dependencies = [":neuroedge_cli"],
entry_point = "./nectl.py",
)
fails in the same way
Why does the pex_binary require explicit constraints?
Shouldn't the CPython>=3.8,<4
configuration work?hundreds-father-404
12/14/2022, 6:12 PM[python].interpreter_constraints
set to? Likely the difference is that run
on a python_source
target (the file argument) only uses a single interpreter. Whereas neuroedge_cli:nectl
first builds the PEX you'd get from ./pants package
, then runs it -- those PEXes are built to work with every interpreter constraint you claim it can work with, e.g. 3.8, 3.9, 3.10aloof-appointment-30987
12/14/2022, 6:13 PM[python]
interpreter_constraints = ["CPython~=3.8"]
without successhundreds-father-404
12/14/2022, 6:14 PMPython>=3.8,<4'
like you had in the BUILD file?aloof-appointment-30987
12/14/2022, 6:25 PMpants.toml
constraint
[python]
interpreter_constraints = ["CPython==3.8.*"]
succeeds when I remove the explicit constraint on the BUILD target.
The tagged version 0.56.0
of numba
shows min_python_version = "3.7"
max_python_version = "3.11" .
So it seems that I cannot use >3.8 but I'm not sure why that is only an issue when running via pex rather than targeting source.hundreds-father-404
12/14/2022, 6:30 PM[python].interpreter_constraints
, which only sets the defualtenough-analyst-54434
12/14/2022, 7:03 PMaloof-appointment-30987
12/14/2022, 9:26 PMthe PEX runtime will figure out 3.11 is no good and use 3.10So I now have, in my
pants.toml
[python]
interpreter_constraints = ["CPython==3.10.*"]
and that works. Plus, its a reasonable project-wide constraint (I believe)
...oh man, I just found a note on the numba install page
Numba is compatible with Python 3.7–3.10That explains why the library was not compatible though I'm still learning how to interpret that
WARNING: Discarding <https://files.pythonhosted>
error message.
Interestingly, I was not encountering this issue before I added Python 3.10.9 to my pyenv related to another project. Not sure if there is any causation or if I created the issue while configuring other dependencies.
Thanks very much for helping me understand and resolve this. I believe I am in good shape.enough-analyst-54434
12/14/2022, 9:28 PM./pants update-lockfiles
.