- 1 year ago
Windows bazel says python is not an executable when building tflite
If you're building TensorFlow Lite (TFLite) with Bazel on Windows and you're getting an error that says "python is not an executable" or "Failed to execute py.exe," it's likely that Bazel is not finding your Python installation.
Here are some steps you can take to resolve the issue:
Ensure that Python is installed on your system and that it's included in your PATH environment variable. You can check this by opening a Command Prompt window and typing
python
. If Python is installed and in your PATH, the Python interpreter should start.Check that Bazel is finding the correct version of Python. You can do this by running the following command:
rubybazel run --platforms=@io_bazel_rules_python//python/platforms:current_cpu py_config
This command should output information about the Python installation that Bazel is using. Ensure that the paths and version numbers are correct.
If Bazel is not finding the correct version of Python, you can specify the path to your Python installation using the
--python_path
flag. For example:javascriptbazel build --python_path=C:/path/to/python.exe //tensorflow/lite:libtensorflowlite.so
This command builds the
libtensorflowlite.so
shared library using the Python executable located atC:/path/to/python.exe
.If none of the above steps work, you may need to reinstall Python or Bazel. Try uninstalling and reinstalling both programs, ensuring that you follow the installation instructions carefully.
Note that the exact steps to resolve this issue may vary depending on your specific configuration and setup. If you continue to experience issues, you may want to reach out to the TensorFlow Lite community for further assistance.