3

I tried to build HandTracker target in xcode and got this errors.

error: An error occurred during the fetch of repository 'local_execution_config_python':
   Traceback (most recent call last):
    File "/private/var/tmp/_bazel_air/295474371363cb7bb712bb69027e5852/external/org_tensorflow/third_party/py/python_configure.bzl", line 213, column 39, in _create_local_python_repository
        numpy_include = _get_numpy_include(repository_ctx, python_bin) + "/numpy"
    File "/private/var/tmp/_bazel_air/295474371363cb7bb712bb69027e5852/external/org_tensorflow/third_party/py/python_configure.bzl", line 187, column 19, in _get_numpy_include
        return execute(
    File "/private/var/tmp/_bazel_air/295474371363cb7bb712bb69027e5852/external/org_tensorflow/third_party/remote_config/common.bzl", line 217, column 13, in execute
        fail(
Error in fail: Problem getting numpy include path.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
Is numpy installed?
error: Analysis of aspect '@tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect of //mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp' failed; build aborted: Problem getting numpy include path.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
Is numpy installed?
note: Elapsed time: 12,284s
note: 0 processes.
error: Build did NOT complete successfully (4 packages loaded, 7 targets configured)
<*> Running Bazel completed in 12509.306 ms
/Users/air/Documents/Mediapipe.xcodeproj/.tulsi/Scripts/bazel_build.py:569: error: Bazel build failed with exit code 1. Please check the build log in Report Navigator (⌘9) for more information.

It says here that I do not have numpy, but I installed it by pip install numpy.

pip list output:

Package       Version
------------- --------
absl-py       0.11.0
dataclasses   0.6
numpy         1.19.3
opencv-python 4.4.0.46
pip           20.3.3
protobuf      3.14.0
setuptools    47.1.0
six           1.15.0
wheel         0.36.2

At first, the project was normally builded, but then I don't remember what I did and these errors began. Python 3.8.5, macOS 11.1, bazel 3.7.2

annaFerdsf
  • 329
  • 2
  • 14

2 Answers2

0

One of the goal of Bazel is to make build reproducibles, so it cannot depend on machine-specific libraries.

You need to define the dependency with pip_import.

rds
  • 26,253
  • 19
  • 107
  • 134
  • Can you tell me in which build file you should write pip dependencies? And what is the syntax of this? – annaFerdsf Dec 28 '20 at 14:10
  • It appears they are trying to build a MediaPipe example, so my guess is that the MediaPipe repository actually needs to define the dependency, not the question asker – Alex Miller Jan 05 '22 at 04:22
  • this actually fixed it for me, by setting the `imports` properly it'll be exposed in your `PYTHONPATH`, if you don't know how to set that check the docu https://bazel.build/reference/be/python – Daniel Andrei Mincă Apr 03 '22 at 15:53
0

I had similar problem when I built bazel using sudo! when I removed sudo every thing worked fine.

Milad Yousefi
  • 191
  • 2
  • 9