cudaGetDeviceCount returned 100 -> no CUDA-capable device is detected

nvcc -V can use normal,but I cannot run the demo (just like “deviceQuery.exe” and so on) rightly.And this is my situation:

(tf3.8) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:26_Pacific_Standard_Time_2019
Cuda compilation tools, release 10.1, V10.1.105

(tf3.8) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite>nvidia-smi
Tue Jun  6 10:20:41 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.98                 Driver Version: 535.98       CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 4080      WDDM  | 00000000:01:00.0  On |                  N/A |
|  0%   30C    P8              11W / 320W |    590MiB / 16376MiB |      6%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A       992    C+G   ...cent\QQGuild\1.3.24-195\QQGuild.exe    N/A      |
|    0   N/A  N/A     10896    C+G   ...inaries\Win64\EpicGamesLauncher.exe    N/A      |
|    0   N/A  N/A     11340    C+G   ...crosoft\Edge\Application\msedge.exe    N/A      |
|    0   N/A  N/A     11432    C+G   C:\Windows\explorer.exe                   N/A      |
|    0   N/A  N/A     13844    C+G   ....Search_cw5n1h2txyewy\SearchApp.exe    N/A      |
|    0   N/A  N/A     15536    C+G   ...ne\Binaries\Win64\EpicWebHelper.exe    N/A      |
|    0   N/A  N/A     15592    C+G   ...CBS_cw5n1h2txyewy\TextInputHost.exe    N/A      |
|    0   N/A  N/A     17504    C+G   ...siveControlPanel\SystemSettings.exe    N/A      |
|    0   N/A  N/A     18192    C+G   ...GeForce Experience\NVIDIA Share.exe    N/A      |
+---------------------------------------------------------------------------------------+

(tf3.8) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite>deviceQuery.exe
deviceQuery.exe Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 100
-> no CUDA-capable device is detected
Result = FAIL

(tf3.8) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite>bandwidthTest.exe
[CUDA Bandwidth Test] - Starting...
Running on...

cudaGetDeviceProperties returned 100
-> no CUDA-capable device is detected
CUDA error at C:/dvs/p4/build/sw/rel/gpgpu/toolkit/r10.1/demo_suite/bandwidthTest/bandwidthTest.cu:255 code=100(cudaErrorNoDevice) "cudaSetDevice(currentDevice)"

and python cannot find GPU:

(tf3.8) D:\TFenv>python
Python 3.8.16 (default, Mar  2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2023-06-06 09:53:40.843735: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
>>> tf.__version__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable
>>> tf.__version__
'2.3.0'
>>> tf.config.list_physical_devices('GPU')
2023-06-06 09:53:59.713062: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2023-06-06 09:53:59.719204: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2023-06-06 09:53:59.721079: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: forMyUnion
2023-06-06 09:53:59.721374: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: forMyUnion
[]
>>> from tensorflow.python.client import device_lib
>>> device_lib.list_local_devices()
2023-06-06 09:54:44.943108: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-06-06 09:54:44.948756: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x13ed7d00330 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2023-06-06 09:54:44.948852: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 13959960267344122449
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 4748881427766356091
physical_device_desc: "device: XLA_CPU device"
]
>>> exit()

my virtual env is:

(tf3.8) C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\demo_suite>pip list
Package                  Version
------------------------ --------
absl-py                  1.4.0
astunparse               1.6.3
boltons                  23.0.0
brotlipy                 0.7.0
cachetools               5.3.1
certifi                  2023.5.7
cffi                     1.15.1
charset-normalizer       3.1.0
colorama                 0.4.6
conda                    23.5.0
conda-package-handling   2.1.0
conda_package_streaming  0.8.0
cryptography             39.0.1
gast                     0.3.3
google-auth              2.19.1
google-auth-oauthlib     1.0.0
google-pasta             0.2.0
grpcio                   1.54.2
h5py                     2.10.0
idna                     3.4
importlib-metadata       6.6.0
jsonpatch                1.32
jsonpointer              2.1
Keras-Preprocessing      1.1.2
Markdown                 3.4.3
MarkupSafe               2.1.3
menuinst                 1.4.19
numpy                    1.18.5
oauthlib                 3.2.2
opt-einsum               3.3.0
packaging                23.0
pip                      23.0.1
pluggy                   1.0.0
protobuf                 4.23.2
pyasn1                   0.5.0
pyasn1-modules           0.3.0
pycosat                  0.6.4
pycparser                2.21
pyOpenSSL                23.0.0
PySocks                  1.7.1
requests                 2.31.0
requests-oauthlib        1.3.1
rsa                      4.9
ruamel.yaml              0.17.21
ruamel.yaml.clib         0.2.6
scipy                    1.4.1
setuptools               67.8.0
six                      1.16.0
tensorboard              2.13.0
tensorboard-data-server  0.7.0
tensorflow-gpu           2.3.0
tensorflow-gpu-estimator 2.3.0
termcolor                2.3.0
toolz                    0.12.0
tqdm                     4.65.0
urllib3                  1.26.16
Werkzeug                 2.3.4
wheel                    0.38.4
win-inet-pton            1.1.0
wrapt                    1.15.0
zipp                     3.15.0
zstandard                0.19.0
>>> import tensorflow as tf
>>> tf.__version__
'2.5.0'
>>> from tensorflow.python.client import device_lib
>>> device_lib.list_local_devices()
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 7838219493416836771
]
>>> exit()

(D:\condaENV\tftest) D:\>conda pip list

CommandNotFoundError: No command 'conda pip'.


(D:\condaENV\tftest) D:\>conda list
# packages in environment at D:\condaENV\tftest:
#
# Name                    Version                   Build  Channel
_tflow_select             2.3.0                       mkl    defaults
abseil-cpp                20210324.2           hd77b12b_0    defaults
absl-py                   1.3.0            py38haa95532_0    defaults
aiohttp                   3.8.3            py38h2bbff1b_0    defaults
aiosignal                 1.2.0              pyhd3eb1b0_0    defaults
appdirs                   1.4.4              pyhd3eb1b0_0    defaults
astor                     0.8.1            py38haa95532_0    defaults
astunparse                1.6.3                      py_0    defaults
async-timeout             4.0.2            py38haa95532_0    defaults
attrs                     22.1.0           py38haa95532_0    defaults
blas                      1.0                         mkl    defaults
blinker                   1.4              py38haa95532_0    defaults
brotlipy                  0.7.0           py38h2bbff1b_1003    defaults
bzip2                     1.0.8                h8ffe710_4    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ca-certificates           2023.01.10           haa95532_0    defaults
cachetools                4.2.2              pyhd3eb1b0_0    defaults
certifi                   2023.5.7         py38haa95532_0    defaults
cffi                      1.15.1           py38h2bbff1b_3    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
click                     8.0.4            py38haa95532_0    defaults
colorama                  0.4.6            py38haa95532_0    defaults
cryptography              39.0.1           py38h21b164f_0    defaults
cudatoolkit               11.3.1               h59b6b97_2    defaults
cudnn                     8.2.1                cuda11.3_0    defaults
flatbuffers               2.0.0                h6c2663c_0    defaults
frozenlist                1.3.3            py38h2bbff1b_0    defaults
gast                      0.4.0              pyhd3eb1b0_0    defaults
giflib                    5.2.1                h8cc25b3_3    defaults
google-auth               2.6.0              pyhd3eb1b0_0    defaults
google-auth-oauthlib      0.4.1                      py_2    defaults
google-pasta              0.2.0              pyhd3eb1b0_0    defaults
grpcio                    1.42.0           py38hc60d5dd_0    defaults
h5py                      3.7.0            py38h3de5c98_0    defaults
hdf5                      1.10.6               h1756f20_1    defaults
icc_rt                    2022.1.0             h6049295_2    defaults
icu                       68.1                 h6c2663c_0    defaults
idna                      3.4              py38haa95532_0    defaults
importlib-metadata        6.0.0            py38haa95532_0    defaults
intel-openmp              2023.1.0         h59b6b97_46319    defaults
jpeg                      9e                   h2bbff1b_1    defaults
keras-preprocessing       1.1.2              pyhd3eb1b0_0    defaults
libcurl                   7.88.1               h86230a5_0    defaults
libffi                    3.4.2                h8ffe710_5    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libpng                    1.6.39               h8cc25b3_0    defaults
libprotobuf               3.14.0               h23ce68f_0    defaults
libsqlite                 3.42.0               hcfcfb64_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libssh2                   1.10.0               hcd4344a_0    defaults
markdown                  3.4.1            py38haa95532_0    defaults
markupsafe                2.1.1            py38h2bbff1b_0    defaults
mkl                       2023.1.0         h8bd8f75_46356    defaults
mkl-service               2.4.0            py38h2bbff1b_1    defaults
mkl_fft                   1.3.6            py38hf11a4ad_1    defaults
mkl_random                1.2.2            py38hf11a4ad_1    defaults
multidict                 6.0.2            py38h2bbff1b_0    defaults
numpy                     1.20.3           py38h749eb61_1    defaults
numpy-base                1.20.3           py38h5bfbeaa_1    defaults
oauthlib                  3.2.2            py38haa95532_0    defaults
openssl                   1.1.1t               h2bbff1b_0    defaults
opt_einsum                3.3.0              pyhd3eb1b0_1    defaults
packaging                 23.0             py38haa95532_0    defaults
pip                       23.1.2             pyhd8ed1ab_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pooch                     1.4.0              pyhd3eb1b0_0    defaults
protobuf                  3.14.0           py38hd77b12b_1    defaults
pyasn1                    0.4.8              pyhd3eb1b0_0    defaults
pyasn1-modules            0.2.8                      py_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyjwt                     2.4.0            py38haa95532_0    defaults
pyopenssl                 23.0.0           py38haa95532_0    defaults
pysocks                   1.7.1            py38haa95532_0    defaults
python                    3.8.16               h6244533_3    defaults
python-flatbuffers        1.12               pyhd3eb1b0_0    defaults
requests                  2.29.0           py38haa95532_0    defaults
requests-oauthlib         1.3.0                      py_0    defaults
rsa                       4.7.2              pyhd3eb1b0_1    defaults
scipy                     1.10.1           py38hdcfc7df_1    defaults
setuptools                67.7.2             pyhd8ed1ab_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six                       1.16.0             pyhd3eb1b0_1    defaults
snappy                    1.1.9                h6c2663c_0    defaults
sqlite                    3.41.2               h2bbff1b_0    defaults
tbb                       2021.8.0             h59b6b97_0    defaults
tensorboard               2.5.0                      py_0    defaults
tensorboard-plugin-wit    1.8.1            py38haa95532_0    defaults
tensorflow                2.5.0           mkl_py38hbe2df88_0    defaults
tensorflow-base           2.5.0           mkl_py38h9201259_0    defaults
tensorflow-estimator      2.5.0              pyh7b7c402_0    defaults
termcolor                 2.1.0            py38haa95532_0    defaults
tk                        8.6.12               h8ffe710_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
typing_extensions         4.5.0            py38haa95532_0    defaults
ucrt                      10.0.22621.0         h57928b3_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
urllib3                   1.26.15          py38haa95532_0    defaults
vc                        14.3                hb25d44b_16    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
vc14_runtime              14.34.31931         h5081d32_16    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
vs2015_runtime            14.34.31931         hed1258a_16    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
werkzeug                  2.2.3            py38haa95532_0    defaults
wheel                     0.35.1             pyhd3eb1b0_0    defaults
win_inet_pton             1.1.0            py38haa95532_0    defaults
wrapt                     1.14.1           py38h2bbff1b_0    defaults
xz                        5.2.6                h8d14728_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
yarl                      1.8.1            py38h2bbff1b_0    defaults
zipp                      3.11.0           py38haa95532_0    defaults
zlib                      1.2.13               h8cc25b3_0    defaults

(D:\condaENV\tftest) D:\>

I changed the version of the tensorflow,and it seemed the GPU was mistaked as XLA_CPU?