https://pantsbuild.org/ logo
#general
Title
# general
p

plain-carpet-73994

07/04/2021, 7:51 PM
I've got a dependency on
pyrealsense2
and I need to build a cross-platform
.pex
that will run on OSX and Linux. I'm building on Linux. I've manually built the right
.whl
file on OSX and uploaded it to a private GCP-based PyPi repo. The following works fine in a
venv
in which I'm running pants:
Copy code
pip install --trusted-host /us-central1-python.pkg.dev --index-url <https://us-central1-python.pkg.dev/infrastructure-314723/python-deps/> --platform macosx_10_15_x86_64 --implementation cp --python-version 37 --abi cp37m --only-binary :all: --target /tmp pyrealsense2
However, a
./pants package /path/to/thing
fails with:
Copy code
$ ./pants package realsense/cli/
12:49:06.11 [INFO] Completed: Resolving 3 requirements: matplotlib, numpy, pyrealsense2
12:49:06.11 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/bin/local_pants_runner.py", line 229, in _run_inner
    return self._perform_run(goals)
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/bin/local_pants_runner.py", line 168, in _perform_run
    return self._perform_run_body(goals, poll=False)
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/bin/local_pants_runner.py", line 185, in _perform_run_body
    return self.graph_session.run_goal_rules(
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/init/engine_initializer.py", line 135, in run_goal_rules
    exit_code = self.scheduler_session.run_goal_rule(
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/engine/internals/scheduler.py", line 530, in run_goal_rule
    self._raise_on_error([t for _, t in throws])
  File "/home/oliver/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0_py38/lib/python3.8/site-packages/pants/engine/internals/scheduler.py", line 498, in _raise_on_error
    raise ExecutionError(

Exception message: 1 Exception encountered:

  ProcessExecutionFailure: Process 'Resolving 3 requirements: matplotlib, numpy, pyrealsense2' failed with exit code 1.
stdout:

stderr:
ERROR: Could not find a version that satisfies the requirement pyrealsense2
ERROR: No matching distribution found for pyrealsense2
pid 587331 -> /home/oliver/.pyenv/versions/3.7.10/bin/python3.7 /home/oliver/.cache/pants/named_caches/pex_root/pip.pex/cf4106b4c7898b462f7c172dde686a9747103f1a --disable-pip-version-check --no-python-version-warning --exists-action a --isolated -q --cache-dir /home/oliver/.cache/pants/named_caches/pex_root --log /tmp/process-executionntUtWf/.tmp/tmpmzcd3hpx/pip.log download --dest /tmp/process-executionntUtWf/.tmp/tmps_6hxe4q/macosx_10_15_x86_64-cp-37-cp37m --platform macosx_10_15_x86_64 --implementation cp --python-version 37 --abi cp37m --only-binary :all: --constraint constraints.txt matplotlib numpy pyrealsense2 --index-url <https://pypi.org/simple/> --find-links <https://us-central1-python.pkg.dev/infrastructure-314723/python-deps/> --retries 5 --timeout 15 exited with 1 and STDERR:
None



(Use --print-stacktrace to see more error details.)
Note that the command line Pants is generating seems to be saying to use my private repo at
<https://us-central1-python.pkg.dev/infrastructure-314723/python-deps/>
. However, I suspect that doesn't know about Google's auth stuff which I did set up correctly with
pip
(see the successful pip install above). Or maybe the issue is that
pyrealsense2
for Linux is coming from
<http://pypi.org|pypi.org>
while for OSX it needs to come from a different repo?? Any help would be appreciated.
Extra info: if I add
/home/oliver/Downloads
to the
[python-repos]
block in
pants.toml
it still fails even though:
Copy code
$ ls /home/oliver/Downloads/pyrealsense2-2.47.0.3313-cp37-cp37m-macosx_10_15_x86_64.whl 
/home/oliver/Downloads/pyrealsense2-2.47.0.3313-cp37-cp37m-macosx_10_15_x86_64.whl
e

enough-analyst-54434

07/05/2021, 3:16 AM
I spy
--constraint constraints.txt
. Does your contraints.txt mention the same version of
pyrealsense2
as your
requirements.txt
? If not, then you get this sort of confusing message from Pip. Pex is tracking this here if so: https://github.com/pantsbuild/pex/issues/1200
p

plain-carpet-73994

07/06/2021, 6:46 PM
yes, the versions match.
8 Views