Errors building Tensorflow from source
Hi @mikcla ,

Thanks for reporting the issues.
Could you please confirm whether you have followed all the instructions mentioned [here](https://www.tensorflow.org/install/source_windows#setup_for_windows).

Also the options from .bazelrc file for AVX instructions:
```
build:native_arch_linux --copt=-march=native
build:avx_win --copt=/arch=AVX
build:avx2_win --copt=/arch=AVX2
```
The command you have used --copt=-march=native might be for linux only. Could you try the remaining two options.

Also for TF2.11 tested Bazel version is 5.3.0 which some times may raise compatibility issues.Please see tested configurations from [here](https://www.tensorflow.org/install/source_windows#tested_build_configurations). I have follwed the instructions to my best abillty, and i am using TF 2.11.0 and Bazel 5.3.0. And what command should i type? You typed 3. Did you tried adding `--copt=/arch=AVX ` `--copt=/arch=AVX2` to the command ? Please confirm.
 @mikcla @SuryanarayanaY  I was able to run the bazel build --config=opt --copt=-march=native //tensorflow/tools/pip_package:build_pip_package successfully for TF 2.11.0 with Bazel 5.3.0 on Windows 10 and for Python 3.10. I think this error is related to the path/environmental variable setup @mraunak I think so to, but I don't how to fix this, I have tried to set system variables, change the path in one of the config files and also tried to change the path in cmd. I am using windows 11 btw.

I’m sorry I don't have everything on hand because I kept moving on with my project, so I took some steps back, and ran simply ran pip install. However I’m willing to try to build from source again some time, but want to have something new to try beforehand. @mikcla ,

From the error log I observed that Python3 library not being detected.This seems issue with some path setting.Also please ensure all the REQUIRED_PACKAGES mentioned in [setup.py](https://github.com/tensorflow/tensorflow/blob/r2.11/tensorflow/tools/pip_package/setup.py) installed before bazel build.

While installing bazel please ensure all these steps mentioned [here](https://bazel.build/install/windows) were followed correctly or not.As other contributor confirmed that he succeeded the build with same commands of your's it might be mostly related to your environment.

Thanks! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59943">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59943">No</a>
 Hi @mikcla Python path setup, please follow the commands below.  To check the path setup of a specific variable if the path set up is correct run sample commands: 'echo %PATH%' or echo %PYTHON_BIN_PATH%

set PATH=path/to/python [e.g. (C:/Python310)]
set PATH=path/to/python/Scripts [e.g. (C:/Python310/Scripts)] 
set PYTHON_BIN_PATH=path/to/python_virtualenv/Scripts/python.exe 
set PYTHON_LIB_PATH=path/to/python virtualenv/lib/site-packages 
set PYTHON_DIRECTORY=path/to/python_virtualenv/Scripts 
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Build/Install

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

2.11.0

### Custom Code

No

### OS Platform and Distribution

Windows 11

### Mobile device

_No response_

### Python version

3.10.10

### Bazel version

5.3.0

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
I am trying to build Tensorflow from source, so i can use AVX, AVX2 and so on.

I typed this command, expecting to build Tensorflow with all supported instruction-sets, my pc supports:

bazel build --config=opt --copt=-march=native //tensorflow/tools/pip_package:build_pip_package
```


### Standalone code to reproduce the issue

```shell
I get these errors:

ERROR: An error occurred during the fetch of repository 'llvm-project':
   Traceback (most recent call last):
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 146, column 25, in _llvm_configure_impl
                _overlay_directories(repository_ctx)
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 49, column 13, in _overlay_directories
                fail("Failed to find python3 binary")
Error in fail: Failed to find python3 binary



ERROR: C:/users/micla/code/python/diceml/tensorflow/WORKSPACE:15:14: fetching llvm_configure rule //external:llvm-project: Traceback (most recent call last):
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 146, column 25, in _llvm_configure_impl
                _overlay_directories(repository_ctx)
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 49, column 13, in _overlay_directories
                fail("Failed to find python3 binary")
Error in fail: Failed to find python3 binary


ERROR: C:/users/micla/code/python/diceml/tensorflow/tensorflow/tools/pip_package/BUILD:276:10: //tensorflow/tools/pip_package:build_pip_package depends on //tensorflow/compiler/mlir/tensorflow:gen_mlir_passthrough_op_py in repository @ which failed to fetch. no such package '@llvm-project//mlir': Failed to find python3 binary


ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: Analysis failed


FAILED: Build did NOT complete successfully (51 packages loaded, 12 targets config\
ured)
    currently loading: tensorflow/lite/tools ... (3 packages)
    Fetching https://storage.googleapis.com/.../flatbuffers/archive/v2.0.6.tar.gz
```


### Relevant log output

```shell
INFO: Reading 'startup' options from c:\users\micla\code\python\diceml\tensorflow\.bazelrc: --output_user_root=C:/tmp, --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=84
INFO: Reading rc options for 'build' from c:\users\micla\code\python\diceml\tensorflow\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/micla/AppData/Local/Microsoft/WindowsApps/python.exe
INFO: Reading rc options for 'build' from c:\users\micla\code\python\diceml\tensorflow\.bazelrc:
  'build' options: --enable_runfiles --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\micla\code\python\diceml\tensorflow\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Users/micla/AppData/Local/Programs/Python/Python310/python.exe --action_env PYTHON_LIB_PATH=C:/Users/micla/AppData/Local/Programs/Python/Python310/lib/site-packages --python_path=C:/Users/micla/AppData/Local/Programs/Python/Python310/python.exe --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --define=override_eigen_strong_inline=true
INFO: Reading rc options for 'build' from c:\users\micla\code\python\diceml\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\micla\code\python\diceml\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\micla\code\python\diceml\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:opt in file c:\users\micla\code\python\diceml\tensorflow\.tf_configure.bazelrc: --copt=/arch:AVX2 --host_copt=/arch:AVX2
INFO: Found applicable config definition build:windows in file c:\users\micla\code\python\diceml\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\micla\code\python\diceml\tensorflow\.bazelrc: --define framework_shared_object=false --define tsl_protobuf_header_only=false --experimental_link_static_libraries_once=false
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/85488e9aae621ec5175b94fc5e31e41b7e5e06ac.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/65f68812d399930d4af587c7a2333e46f367c5a7.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Repository llvm-project instantiated at:
  C:/users/micla/code/python/diceml/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:975:21: in workspace
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:539:15: in _tf_repositories
  C:/users/micla/code/python/diceml/tensorflow/third_party/llvm/setup.bzl:22:19: in llvm_setup
Repository rule llvm_configure defined at:
  C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl:169:33: in <toplevel>
ERROR: An error occurred during the fetch of repository 'llvm-project':
   Traceback (most recent call last):
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 146, column 25, in _llvm_configure_impl
                _overlay_directories(repository_ctx)
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 49, column 13, in _overlay_directories
                fail("Failed to find python3 binary")
Error in fail: Failed to find python3 binary
ERROR: C:/users/micla/code/python/diceml/tensorflow/WORKSPACE:15:14: fetching llvm_configure rule //external:llvm-project: Traceback (most recent call last):
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 146, column 25, in _llvm_configure_impl
                _overlay_directories(repository_ctx)
        File "C:/tmp/hn4nqluc/external/llvm-raw/utils/bazel/configure.bzl", line 49, column 13, in _overlay_directories
                fail("Failed to find python3 binary")
Error in fail: Failed to find python3 binary
INFO: Repository build_bazel_rules_android instantiated at:
  C:/users/micla/code/python/diceml/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:975:21: in workspace
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:814:20: in _tf_repositories
  C:/users/micla/code/python/diceml/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  C:/users/micla/code/python/diceml/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
INFO: Repository flatbuffers instantiated at:
  C:/users/micla/code/python/diceml/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:968:28: in workspace
  C:/users/micla/code/python/diceml/tensorflow/tensorflow/workspace2.bzl:65:16: in _initialize_third_party
  C:/users/micla/code/python/diceml/tensorflow/third_party/flatbuffers/workspace.bzl:6:20: in repo
  C:/users/micla/code/python/diceml/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  C:/users/micla/code/python/diceml/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
ERROR: C:/users/micla/code/python/diceml/tensorflow/tensorflow/tools/pip_package/BUILD:276:10: //tensorflow/tools/pip_package:build_pip_package depends on //tensorflow/compiler/mlir/tensorflow:gen_mlir_passthrough_op_py in repository @ which failed to fetch. no such package '@llvm-project//mlir': Failed to find python3 binary
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: Analysis failed
INFO: Elapsed time: 399.994s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (51 packages loaded, 12 targets config\
ured)
    currently loading: tensorflow/lite/tools ... (3 packages)
    Fetching https://storage.googleapis.com/.../flatbuffers/archive/v2.0.6.tar.gz
```
</details>