ERROR: @local_config_cuda//:enable_cuda :: Error loading option @local_config_cuda//:enable_cuda: 'NoneType' value has no field or method 'replace'
@ensound1,
The error seems to be a bad path. Can you please try to edit the file **"tensorflow/third_party/gpus/cuda_configure.bzl"**, line 1400 to identify what path the code is looking for and then validate that it exists? I also suspect that the problem comes from the global environment, have you added the MVSC_tool to your path? and if so check if you have the cl.exe file inside it. 

Could you try **bazel clean --expunge** followed by bazel sync. Also try to set the **BAZEL_SH** environment variable, restarting the pc and run the cmd with Administrator rights. Thank you! if i change at line 100
def _get_msvc_compiler(repository_ctx):
    vc_path = find_vc_path(repository_ctx)
    print("vc_path: ", vc_path")
    return find_msvc_tool(repository_ctx, vc_path, "cl.exe").replace("\\", "/")
i get  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64
which exist and points to cl.exe. If i simply write cl it executes, so globally it is also set.

If i run bazel sync i get a bunch of  errors... the first 2 are



C:\Users\aless\dev\tensorflow>bazel sync
INFO: Repository build_bazel_rules_swift_local_config instantiated at:
  C:/users/aless/dev/tensorflow/WORKSPACE:23:14: in <toplevel>
  C:/users/aless/dev/tensorflow/tensorflow/workspace0.bzl:125:29: in workspace
  C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/repositories.bzl:123:11: in swift_rules_dependencies
  C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/repositories.bzl:32:18: in _maybe
Repository rule swift_autoconfiguration defined at:
  C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/internal/swift_autoconfiguration.bzl:302:42: in <toplevel>
ERROR: An error occurred during the fetch of repository 'build_bazel_rules_swift_local_config':
   Traceback (most recent call last):
        File "C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/internal/swift_autoconfiguration.bzl", line 300, column 32, in _swift_autoconfiguration_impl
                _create_linux_toolchain(repository_ctx)
        File "C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/internal/swift_autoconfiguration.bzl", line 212, column 13, in _create_linux_toolchain
                fail("ERROR: rules_swift uses Bazel's CROSSTOOL to link, but Swift " +
Error in fail: ERROR: rules_swift uses Bazel's CROSSTOOL to link, but Swift requires that the driver used is clang. Please set `CC=clang` in your environment before invoking Bazel.
ERROR: C:/users/aless/dev/tensorflow/WORKSPACE:23:14: fetching swift_autoconfiguration rule //external:build_bazel_rules_swift_local_config: Traceback (most recent call last):
        File "C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/internal/swift_autoconfiguration.bzl", line 300, column 32, in _swift_autoconfiguration_impl
                _create_linux_toolchain(repository_ctx)
        File "C:/users/aless/_bazel_aless/ozqc7q5z/external/build_bazel_rules_swift/swift/internal/swift_autoconfiguration.bzl", line 212, column 13, in _create_linux_toolchain
                fail("ERROR: rules_swift uses Bazel's CROSSTOOL to link, but Swift " +
Error in fail: ERROR: rules_swift uses Bazel's CROSSTOOL to link, but Swift requires that the driver used is clang. Please set `CC=clang` in your environment before invoking Bazel.
INFO: Repository sigbuild-r2.10-python3.7_config_nccl instantiated at:
  C:/users/aless/dev/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/aless/dev/tensorflow/tensorflow/workspace2.bzl:879:19: in workspace
  C:/users/aless/dev/tensorflow/tensorflow/workspace2.bzl:86:27: in _tf_toolchains
  C:/users/aless/dev/tensorflow/tensorflow/tools/toolchains/remote_config/configs.bzl:257:24: in initialize_rbe_configs
  C:/users/aless/dev/tensorflow/tensorflow/tools/toolchains/remote_config/rbe_config.bzl:184:30: in sigbuild_tf_configs
Repository rule remote_nccl_configure defined at:
  C:/users/aless/dev/tensorflow/third_party/nccl/nccl_configure.bzl:134:40: in <toplevel>
ERROR: An error occurred during the fetch of repository 'sigbuild-r2.10-python3.7_config_nccl':
   Traceback (most recent call last):
        File "C:/users/aless/dev/tensorflow/third_party/nccl/nccl_configure.bzl", line 77, column 35, in _create_local_nccl_repository
                cuda_config = find_cuda_config(repository_ctx, find_cuda_config_path, ["cuda"])
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 649, column 41, in find_cuda_config
                exec_result = _exec_find_cuda_config(repository_ctx, script_path, cuda_libraries)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 643, column 19, in _exec_find_cuda_config
                return execute(repository_ctx, [python_bin, "-c", decompress_and_execute_cmd])
        File "C:/users/aless/dev/tensorflow/third_party/remote_config/common.bzl", line 230, column 13, in execute
                fail(
Error in fail: Repository command failed
java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\aless\_bazel_aless\ozqc7q5z\external\sigbuild-r2.10-python3.7_config_nccl\usr\bin\python3" -c "from zlib import decompress;from base64 import b64decode;from os import system;script = decompress(b64decode('eJzdPGtz48aR3/krJtjbEqilIMmXcuV4kVOytHvWRZG2JO76UhLDjIAhBS8I8ACQEpPKf093zwODAUC9LHvLqvKaAKZ7unv6Oa837ChbrPN4dluyb/b2/4uNbgUbibTI8g9JdscOl+VtlhcBO0wSdoHNCnYhCpGvRBT03vTesNM4hOYiYss0EjkrAf5wwUP4n/oyYJ9FXsRZyr4J9piPDTz1yev/N2BYZ0s252uWZiVbFgJQxAWbxolg4j4Ui5LFKQuz+SKJeRoKdheXt9SNQgJk(...)): Impossibile trovare il file specificato.
 (error: 2)

i dont really understand why i read linux while im on windows @ensound1,
I suspect there are some discrepancies happening because of multiple environments in the system. Could you please try to create the virtual environment and try to follow the steps for the installation. Also Have you tried **--config=nccl**  command during Tensorflow build run. Thank you!
### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

2.10.0

### Custom code

No

### OS platform and distribution

windows 11

### Mobile device

_No response_

### Python version

3.9.12

### Bazel version

5.1.1 (bazelisk)

### GCC/compiler version

msvc 2019

### CUDA/cuDNN version

11.1 8.1

### GPU model and memory

RTX4090 32GB

### Current behavior?

I was trying to build tensorflow for c++ api use on visual studio, with support for gpu. CUDA/cuDNN/TensorRT. It seems there is a problem with finding the path for the compiler. But if i run cl on console it finds it and its correctly added to path

### Standalone code to reproduce the issue

```shell
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout v2.10.0
python .\configure.py

bazel clean --expunge
bazel build //tensorflow:tensorflow_cc.dll //tensorflow:tensorflow_cc.lib
```


### Relevant log output

```shell
C:\Users\aless\dev\tensorflow>bazel build //tensorflow:tensorflow_cc.dll //tensorflow:tensorflow_framework.dll
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=120
INFO: Reading rc options for 'build' from c:\users\aless\dev\tensorflow\.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/aless/AppData/Local/Programs/Python/Python39/python.exe
INFO: Reading rc options for 'build' from c:\users\aless\dev\tensorflow\.bazelrc:
  'build' options: --define framework_shared_object=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
INFO: Reading rc options for 'build' from c:\users\aless\dev\tensorflow\.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=C:/Users/aless/AppData/Local/Programs/Python/Python39/python.exe --action_env PYTHON_LIB_PATH=C:/Users/aless/AppData/Local/Programs/Python/Python39/lib/site-packages --python_path=C:/Users/aless/AppData/Local/Programs/Python/Python39/python.exe --config=tensorrt --action_env CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1 --action_env TF_CUDA_COMPUTE_CAPABILITIES=8.9 --config=cuda --copt=/d2ReducedOptimizeHugeFunctions --host_copt=/d2ReducedOptimizeHugeFunctions --define=override_eigen_strong_inline=true
INFO: Reading rc options for 'build' from c:\users\aless\dev\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/common,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\aless\dev\tensorflow\.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file c:\users\aless\dev\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:tensorrt in file c:\users\aless\dev\tensorflow\.bazelrc: --repo_env TF_NEED_TENSORRT=1
INFO: Found applicable config definition build:cuda in file c:\users\aless\dev\tensorflow\.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda
INFO: Found applicable config definition build:windows in file c:\users\aless\dev\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=/experimental:preprocessor --host_copt=/experimental: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\aless\dev\tensorflow\.bazelrc: --define framework_shared_object=false --experimental_link_static_libraries_once=false
INFO: Repository local_config_cuda instantiated at:
  C:/users/aless/dev/tensorflow/WORKSPACE:15:14: in <toplevel>
  C:/users/aless/dev/tensorflow/tensorflow/workspace2.bzl:879:19: in workspace
  C:/users/aless/dev/tensorflow/tensorflow/workspace2.bzl:91:19: in _tf_toolchains
Repository rule cuda_configure defined at:
  C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl:1453:33: in <toplevel>
ERROR: An error occurred during the fetch of repository 'local_config_cuda':
   Traceback (most recent call last):
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 1406, column 38, in _cuda_autoconf_impl
                _create_local_cuda_repository(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 1184, column 17, in _create_local_cuda_repository
                cc = find_cc(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 216, column 34, in find_cc
                return _get_msvc_compiler(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 133, column 61, in _get_msvc_compiler
                return find_msvc_tool(repository_ctx, vc_path, "cl.exe").replace("\\", "/")
Error: 'NoneType' value has no field or method 'replace'
ERROR: C:/users/aless/dev/tensorflow/WORKSPACE:15:14: fetching cuda_configure rule //external:local_config_cuda: Traceback (most recent call last):
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 1406, column 38, in _cuda_autoconf_impl
                _create_local_cuda_repository(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 1184, column 17, in _create_local_cuda_repository
                cc = find_cc(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 216, column 34, in find_cc
                return _get_msvc_compiler(repository_ctx)
        File "C:/users/aless/dev/tensorflow/third_party/gpus/cuda_configure.bzl", line 133, column 61, in _get_msvc_compiler
                return find_msvc_tool(repository_ctx, vc_path, "cl.exe").replace("\\", "/")
Error: 'NoneType' value has no field or method 'replace'
INFO: Found applicable config definition build:cuda in file c:\users\aless\dev\tensorflow\.bazelrc: --repo_env TF_NEED_CUDA=1 --crosstool_top=@local_config_cuda//crosstool:toolchain --@local_config_cuda//:enable_cuda
ERROR: @local_config_cuda//:enable_cuda :: Error loading option @local_config_cuda//:enable_cuda: 'NoneType' value has no field or method 'replace'
```
