bazelbuild / rules_docker

Rules for building and handling Docker images with Bazel
Apache License 2.0
1.07k stars 692 forks source link

py3_image: No Matching Toolchains Found #2274

Open SvenKratzEasel opened 1 year ago

SvenKratzEasel commented 1 year ago

🐞 bug report

Affected Rule

py3_image

Description

No matching toolchains found.

🔬 Minimal Reproduction

Command

bazel build  :preprocess_main_img
INFO: Build option --toolchain_resolution_debug has changed, discarding analysis cache.
ERROR: /home/sven/main/backend/lora_enrollment/lora_training/BUILD:6:10: While resolving toolchains for target //backend/lora_enrollment/lora_training:preprocess_main_img.binary: No matching toolchains found for types @bazel_tools//tools/python:toolchain_type.
To debug, rerun with --toolchain_resolution_debug='@bazel_tools//tools/python:toolchain_type'
If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '//backend/lora_enrollment/lora_training:preprocess_main_img' failed; build aborted: 
INFO: Elapsed time: 0.166s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (26 packages loaded, 314 targets configured)

Rule Call:

py3_image(
    name = "preprocess_main_img",
    srcs = ["preprocess_main.py"],
    layers = [
        requirement("grpcio"),
        requirement("transformers"),
        requirement("pillow"),
        requirement("torch"),
        requirement("opencv-python"),
        requirement("deepface"),
        requirement("zmq"),
        requirement("accelerate"),
        requirement("jmespath"),
        requirement("exceptiongroup"),
        requirement("nvidia_cuda_cupti_cu11"),
        ":add_background",
        "//backend/utils/logging:easel_logging",
    ],
    base=":python3.10",
    data = ["train"],
    visibility = ["//visibility:public"],
    main = "preprocess_main.py",
)

Python Setup in WORKSPACE:

http_archive(
    name = "rules_python",
    sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
    strip_prefix = "rules_python-0.25.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")

py_repositories()

python_register_toolchains(
    name = "python3_10",
    # Available versions are listed in @rules_python//python:versions.bzl.
    # We recommend using the same version your team is already standardized on.
    python_version = "3.10.12",
)

load("@python3_10//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
    name = "pip",
    python_interpreter_target = interpreter,
    requirements_lock = "//third_party/python:requirements.txt",
)

load("@pip//:requirements.bzl", "install_deps")

install_deps()

🔥 Exception or Error






🌍 Your Environment

Operating System:

Linux 5.15.0-75-generic #82~20.04.1-Ubuntu SMP Wed Jun 7 19:37:37 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of bazel version:

  
Build label: 6.3.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Aug 8 15:48:33 2023 (1691509713)
Build timestamp: 1691509713
Build timestamp as int: 1691509713
  

Rules_docker version:

  
http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
    urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)