larq / compute-engine

Highly optimized inference engine for Binarized Neural Networks
https://docs.larq.dev/compute-engine
Apache License 2.0
243 stars 35 forks source link

Error while building pip package on Fedora #811

Closed BenCrulis closed 3 months ago

BenCrulis commented 3 months ago

I am trying to compile the compute engine on Fedora using bazelisk following the tutorial at https://docs.larq.dev/compute-engine/build/converter/ , but I keep getting the same error:

ERROR: /home/crulis/.cache/bazel/_bazel_crulis/62e1e4d39f6188ec1a55a421a458a28d/external/pypi_lce_tensorflow/BUILD.bazel:22:11: no such package '@pypi_lce_tensorflow_io_gcs_filesystem//': The repository '@pypi_lce_tensorflow_io_gcs_filesystem' could not be resolved: Repository '@pypi_lce_tensorflow_io_gcs_filesystem' is not defined and referenced by '@pypi_lce_tensorflow//:pkg'
ERROR: Analysis of target '//:build_pip_pkg' failed; build aborted:

I tried the following commands:

bazelisk build :build_pip_pkg
bazelisk build :build_pip_pkg -c opt --config=release_cpu_linux --copt=-fvisibility=hidden --verbose_failures

I also tried to install different versions of tensorflow: 2.13.1, 2.16.1 and different python versions: 3.9, 3.10, 3.11, each time creating a new virtual environment and running a full clean using bazelisk clean --expunge. I am also regularly deleting the bazel cache directory just in case.

What am I doing wrong?

Bazel information

bazel 6.5.0

Git information

lce: HEAD detached at v0.16.0 third_party/tensorflow: HEAD detached at v2.16.1 (I also tried 2.13.1)

System information:

System: Kernel: 6.9.9-200.fc40.x86_64 arch: x86_64 bits: 64 compiler: gcc v: 2.41-37.fc40 clocksource: tsc Desktop: Cinnamon v: 6.2.4 tk: GTK v: 3.24.43 wm: Muffin vt: 2 dm: 1: GDM v: 46.2 2: LightDM v: 1.32.0 note: stopped Distro: Fedora Linux 40 (Cinnamon) Machine: Type: Laptop System: Dell product: Latitude 5410 v: N/A serial: Chassis: type: 10 serial: Mobo: Dell model: 06KF2W v: A00 serial: part-nu: 09A0 uuid: UEFI: Dell v: 1.28.0 date: 04/08/2024 CPU: Info: quad core model: Intel Core i5-10310U bits: 64 type: MT MCP smt: enabled arch: Comet/Whiskey Lake note: check rev: C cache: L1: 256 KiB L2: 1024 KiB L3: 6 MiB Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Info: Compilers: clang: 18.1.6 gcc: 14.1.1 Client: Unknown Client: cinnamon (deleted) inxi: 3.3.34

Tombana commented 3 months ago

Hi @BenCrulis, thank you for reporting this.

It seems that there's an error when bazel is resolving pip package dependencies. Bazel says that the tensorflow package depends on tensorflow-io-gcs-filesystem but this latter package is not in the requirements.txt file: https://github.com/larq/compute-engine/blob/main/larq_compute_engine/requirements.txt

Could you try if re-generating requirements.txt solves it? You can do that by running:

pip-compile --allow-unsafe --no-emit-index-url --strip-extras larq_compute_engine/requirements.in
BenCrulis commented 3 months ago

@Tombana Thank you, it did compile after regenerating the file and installing the dependencies, although it took quite a while.

The website documentation should probably indicate that the dependencies have to be installed through pip, it is only mentioned that the tensorflow package should be installed there.

Tombana commented 3 months ago

Thanks @BenCrulis, glad to hear it worked. We'll update the documentation on the website.