Windows bazel говорит, что Python не является исполняемым файлом при сборке tflitePython

Программы на Python
Anonymous
Windows bazel говорит, что Python не является исполняемым файлом при сборке tflite

Сообщение Anonymous »

Я пытаюсь собрать tflite на C++ для Windows с использованием bazel, следуя официальной документации. На данный момент я установил все, что мне нужно, и добавил их в PATH. Затем я клонировал репозиторий github и извлек его из ветки r2.12.
Затем я запустил python ./configure.py и выбрал для всего по умолчанию (сказал да, чтобы переопределить собственную сильную строку). При этом он объявил, что мой Python находится в C:\Users\Asus\AppData\Local\Programs\Python\Python311\python.exe.
После этого запуска bazel build -c opt //tensorflow/lite:tensorflowlite в каталоге, где я клонировал tensorflow в cmd, вызывает эту ошибку:

Код: Выделить всё

Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=117
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
'build' options: --python_path=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.tf_configure.bazelrc:
'build' options: --action_env PYTHON_BIN_PATH=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe --action_env PYTHON_LIB_PATH=C:/Users/Asus/AppData/Local/Programs/Python/Python311/Lib/site-packages --python_path=C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --define=override_eigen_strong_inline=true
INFO: Reading rc options for 'build' from c:\users\asus\desktop\tensorflow\.bazelrc:
'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file c:\users\asus\desktop\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\asus\desktop\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:windows in file c:\users\asus\desktop\tensorflow\.bazelrc: --copt=/W0 --host_copt=/W0 --copt=/Zc:__cplusplus --host_copt=/Zc:__cplusplus --copt=/D_USE_MATH_DEFINES --host_copt=/D_USE_MATH_DEFINES --features=compiler_param_file --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --copt=/Zc:preprocessor --host_copt=/Zc:preprocessor --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --verbose_failures --features=compiler_param_file --distinct_host_configuration=false
INFO: Found applicable config definition build:monolithic in file c:\users\asus\desktop\tensorflow\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
INFO: Repository local_config_python instantiated at:
C:/users/asus/desktop/tensorflow/WORKSPACE:15:14:  in 
C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:957:19: in workspace
C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:104:21: in _tf_toolchains
Repository rule python_configure defined at:
C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl:298:35: in 
ERROR: An error occurred during the fetch of repository 'local_config_python':
Traceback (most recent call last):
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 271, column 40, in _python_autoconf_impl
_create_local_python_repository(repository_ctx)
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
_check_python_bin(repository_ctx, python_bin)
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 145, column 25, in _check_python_bin
auto_config_fail("--define %s='%s' is not executable. Is it the python binary?" % (
File "C:/users/asus/desktop/tensorflow/third_party/remote_config/common.bzl", line 12, column 9, in auto_config_fail
fail("%sConfiguration Error:%s %s\n" % (red, no_color, msg))
Error in fail: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable. Is it the python binary?
ERROR: C:/users/asus/desktop/tensorflow/WORKSPACE:15:14: fetching python_configure rule //external:local_config_python: Traceback (most recent call last):
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 271, column 40, in _python_autoconf_impl
_create_local_python_repository(repository_ctx)
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 212, column 22, in _create_local_python_repository
_check_python_bin(repository_ctx, python_bin)
File "C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl", line 145, column 25, in _check_python_bin
auto_config_fail("--define %s='%s' is not executable. Is it the python binary?" % (
File "C:/users/asus/desktop/tensorflow/third_party/remote_config/common.bzl", line 12, column 9, in auto_config_fail
fail("%sConfiguration Error:%s %s\n" % (red, no_color, msg))
Error in fail: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable. Is it the python binary?
INFO: Repository local_execution_config_python instantiated at:
C:/users/asus/desktop/tensorflow/WORKSPACE:15:14: in 
C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:957:19: in workspace
C:/users/asus/desktop/tensorflow/tensorflow/workspace2.bzl:94:27: in _tf_toolchains
C:/users/asus/desktop/tensorflow/tensorflow/tools/toolchains/remote_config/configs.bzl:6:28: in initialize_rbe_configs
C:/users/asus/desktop/tensorflow/tensorflow/tools/toolchains/remote_config/rbe_config.bzl:158:27: in _tensorflow_local_config
Repository rule local_python_configure defined at:
C:/users/asus/desktop/tensorflow/third_party/py/python_configure.bzl:279:41: in 
INFO: Repository go_sdk instantiated at:
C:/users/asus/desktop/tensorflow/WORKSPACE:23:14: in 
C:/users/asus/desktop/tensorflow/tensorflow/workspace0.bzl:134:20: in workspace
C:/users/asus/_bazel_asus/ddsftcyc/external/com_github_grpc_grpc/bazel/grpc_extra_deps.bzl:36:27: in grpc_extra_deps
C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:431:28: in go_register_toolchains
C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:130:21: in go_download_sdk
Repository rule _go_download_sdk defined at:
C:/users/asus/_bazel_asus/ddsftcyc/external/io_bazel_rules_go/go/private/sdk.bzl:117:35: in 
ERROR: Analysis of target '//tensorflow/lite:tensorflowlite' failed; build aborted: Configuration Error: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' is not executable.  Is it the python binary?
INFO: Elapsed time: 224.163s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (32 packages loaded, 15 targets configured)
Глядя на основную часть ошибки в этом выводе: ОШИБКА: анализ цели '//tensorflow/lite:tensorflowlite' не удался; сборка прервана: ошибка конфигурации: --define PYTHON_BIN_PATH='C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe' не является исполняемым файлом. Это бинарный файл Python?
Я проверил, есть там Python или нет, это действительно так. Простой запуск C:/Users/Asus/AppData/Local/Programs/Python/Python311/python.exe в cmd действительно открывает Python.
Поэтому я проверил Интернет на наличие некоторых решения, я удалил «установщики Python» из своей системы, добавил Python в PATH, попробовал те же действия с zip-архивом исходного кода Tensorflow вместо его клонирования, ничего не работает.
Некоторые люди предлагали изменил некоторые вещи внутри каталога py tensorflow, но это тоже не сработало.
Почему это происходит? Что заставляет Bazel не видеть Python, хотя он есть? Как я могу это исправить и получить сборку с Windows?

Подробнее здесь: https://stackoverflow.com/questions/759 ... ing-tflite

Вернуться в «Python»