silly-queen-7197
06/21/2023, 12:30 AMgrpcio
. Unfortunately I'm not able to reproduce the error exactly (for whatever reason it works on my machine). If I remove the version in my requirements.txt
I can get it to fail (I'm not sure if it's failing for the same reason) but I wanted to take this chance to provide some feedback on how a novice pants user would try to resolve this.
I'm only interested in figuring out why grpcio isn't working so let's make a dummy target
pex_binary(
name="foo",
dependencies=["//:reqs#grpcio"]
)
Since grpcio logs are noisy I'll run ./pants --keep-sandboxes=on_failure package related-titles:foo > logs.txt 2>&1
since in my terminal I can't scroll up enough.
Okay the logs show me
16:59:50.77 [INFO] Preserving local process execution dir /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-ql5kML for Test binary /Users/yjabri/.pyenv/shims/python3.
16:59:50.84 [INFO] Preserving local process execution dir /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-UIqbuV for Test binary /Users/yjabri/.pyenv/shims/python.
16:59:50.92 [INFO] Preserving local process execution dir /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-iY4rld for Test binary /usr/local/bin/python.
16:59:50.93 [INFO] Starting: Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio
17:00:58.99 [INFO] Preserving local process execution dir /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-zwQ29T for Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio
17:00:58.99 [INFO] Completed: Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio
So far so good.
Engine traceback:
in `package` goal
ProcessExecutionFailure: Process 'Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio' failed with exit code 1.
stdout:
This is kind of odd. The error is the following command exited with 1 and STDERR:
/Users/yjabri/.cache/pants/named_caches/pex_root/venvs/41379f21c5956cff0d35ab1ef014bb72e1fe14dc/389476d3d6dcf639f35a0bd43926d6b11532a553/bin/python \
-sE /Users/yjabri/.cache/pants/named_caches/pex_root/venvs/41379f21c5956cff0d35ab1ef014bb72e1fe14dc/389476d3d6dcf639f35a0bd43926d6b11532a553/pex \
--disable-pip-version-check \
--no-python-version-warning \
--exists-action a \
--no-input \
--use-deprecated legacy-resolver \
--isolated \
-q \
--cache-dir /Users/yjabri/.cache/pants/named_caches/pex_root/pip_cache wheel \
--no-deps \
--wheel-dir /Users/yjabri/.cache/pants/named_caches/pex_root/built_wheels/sdists/grpcio-1.49.1.tar.gz/d4725fc9ec8e8822906ae26bb26f5546891aa7fbc3443de970cc556d43a5c99f/cp310-cp310-macosx_12_0_arm64.d2f5ef92ac104f0ab9de11c572b97357 \
/Users/yjabri/.cache/pants/named_caches/pex_root/downloads/d4725fc9ec8e8822906ae26bb26f5546891aa7fbc3443de970cc556d43a5c99f/grpcio-1.49.1.tar.gz \
--index-url <https://pypi.org/simple/> \
--extra-index-url https://**********:@pypi.fury.io/amlg/ \ (almost posted the credentials in plaintext...)
--retries 5 \
--timeout 15
failed. At this point I'm not really sure where this is running. If I try to run it in the current directory I get ModuleNotFoundError: No module named 'pex'
. Same thing if I run it in the last sandbox pants told me about (/private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-zwQ29T)
At this point what should I look for?silly-queen-7197
06/21/2023, 12:34 AM./related-titles/foo.pex
from the sandbox I can do stuff like
>>> from grpc import server
>>> help(server)
and it all workssilly-queen-7197
06/21/2023, 12:38 AM./pants --keep-sandboxes=on_failure package related-titles:foo
appears to just worksilly-queen-7197
06/21/2023, 12:48 AMrm -fr ~/.cache/pants && rm -fr .pids && rm -fr .pants.d
I can reproduce the abovesilly-queen-7197
06/21/2023, 12:57 AM./related-titles/foo.pex
wide-midnight-78598
06/21/2023, 12:58 AMwide-midnight-78598
06/21/2023, 12:59 AMsilly-queen-7197
06/21/2023, 12:59 AMinterpreter_constraints = ["CPython==3.10.*"]
silly-queen-7197
06/21/2023, 1:00 AMwide-midnight-78598
06/21/2023, 1:00 AM./pants
in lieu of the pants
runner. Any particular reason? Or just historical?silly-queen-7197
06/21/2023, 1:01 AMsilly-queen-7197
06/21/2023, 1:01 AMwide-midnight-78598
06/21/2023, 1:01 AMwide-midnight-78598
06/21/2023, 1:02 AMsilly-queen-7197
06/21/2023, 1:03 AMwide-midnight-78598
06/21/2023, 1:05 AMsilly-queen-7197
06/21/2023, 1:23 AMbrew install pantsbuild/tap/pants
and give that a shotwide-midnight-78598
06/21/2023, 1:23 AMgreen "Bootstrapping Pants using ${python}"
I vaguely recall a debug mechanism toosilly-queen-7197
06/21/2023, 1:24 AM./pants
appears to be using Bootstrapping Pants using /Users/yjabri/.pyenv/shims/python3.9
.
Thanks I'll see what my coworker gets tomorrow! Appreciate the help so farwide-midnight-78598
06/21/2023, 1:26 AMpants
runner will automatically install the correct Python (3.9) to run pants, turning that into an implementation detail - way better way forward.
Ah, okay, you were using pyenv - that makes sense.
Another note: Does GRPC have wheels for Python 3.10, for MacOS ARM, on 1.49.1 ?
That's another thing to maybe look into - if that might be causing some problems between yours and your colleague's setups?silly-queen-7197
06/21/2023, 1:31 AMpip install --no-cache-dir --isolated grpcio~=1.49.1
(I need to do more research into what isolated
does)silly-queen-7197
06/21/2023, 2:31 AM./pants --version
I get
Bootstrapping Pants using /Users/yjabri/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Installing pantsbuild.pants==2.15.0 into a virtual environment at /Users/yjabri/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39
New virtual environment successfully created at /Users/yjabri/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39.
...
they get
Bootstrapping Pants using /Users/dongp0509/opt/anaconda3/bin/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Scrubbing PYTHONPATH
Installing pantsbuild.pants==2.15.0 into a virtual environment at /Users/dongp0509/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39
Scrubbing PYTHONPATH
New virtual environment successfully created at /Users/dongp0509/.cache/pants/setup/bootstrap-Darwin-arm64/2.15.0_py39.
...
silly-queen-7197
06/21/2023, 2:31 AMScrubbing PYTHONPATH
?silly-queen-7197
06/21/2023, 5:24 AM__run.sh
isn't populated initially when the sandbox is created? The second is that if I remove
[subprocess-environment]
env_vars = [
'GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1',
'GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1',
'GRPC_BUILD_WITH_BORING_SSL_ASM=',
]
in the logs I see
22:17:33.32 [INFO] Starting: Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio~=1.49.1
22:17:33.32 [INFO] Preserving local process execution dir /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-zK9DIG for Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio~=1.49.1
22:18:33.12 [INFO] Completed: Building 1 requirement for related-titles/foo.pex from the 3rdparty/python/default.lock resolve: grpcio~=1.49.1
there is no related-titles/foo.pex
. At this point I'm supposed to debug via __run.sh
but if I run bash __run.sh
it works and related-titles/foo.pex
is populated?silly-queen-7197
06/21/2023, 5:29 AMenv -i ./__run.sh
(looks like I don't need bash as its an executable)silly-queen-7197
06/21/2023, 5:42 AMenv -i GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 GRPC_BUILD_WITH_BORING_SSL= ./__run.sh
works
So this is more or less what I was expecting to happen because that's what folks on this form said would happen lol. This is just a little more spelled out. I think I just botched the execution at the end of the work day (and was thrown off by things like __run.sh missing initially)silly-queen-7197
06/21/2023, 5:34 PMpyenv install 3.9
things worked 🤷♂️silly-queen-7197
06/21/2023, 5:36 PMCPPFLAGS=-I/opt/homebrew/opt/openssl@3/include
LDFLAGS=-L/opt/homebrew/opt/openssl@3/lib
I wonder if those have a side effect when installing python? Then again I don't think pyenv installed anything from source...