pytorch Python不检测cuda,尽管nvcc --version检测到了

zpgglvta  于 2023-10-20  发布在  Python
关注(0)|答案(1)|浏览(160)

我正试图使cuda工作在miniconda3上运行模型等在我的gpu上,这是:

不知怎么的就是不管用cuda安装在我的pc上,cudatoolkit和cuda包一般都安装在环境中。
这就是我做的结果
nvcc --version

这些是安装在环境中的conda包

# Name                    Version                   Build  Channel
absl-py                   2.0.0                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
blas                      1.0                         mkl
brotli                    1.1.0                hcfcfb64_1    conda-forge
brotli-bin                1.1.0                hcfcfb64_1    conda-forge
brotli-python             1.1.0           py311h12c1d0e_1    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.08.22           haa95532_0    anaconda
cachetools                5.3.1                    pypi_0    pypi
certifi                   2023.7.22       py311haa95532_0    anaconda
cffi                      1.16.0          py311ha68e1ae_0    conda-forge
charset-normalizer        3.3.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
contourpy                 1.1.1           py311h005e61a_1    conda-forge
cuda                      11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-cccl                 11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-command-line-tools   11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-compiler             11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-cudart               11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-cudart-dev           11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-cuobjdump            11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-cupti                11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-cuxxfilt             11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-libraries            11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-libraries-dev        11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-memcheck             11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nsight-compute       11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-nvcc                 11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvdisasm             11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvml-dev             11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvprof               11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvprune              11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvrtc                11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvrtc-dev            11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvtx                 11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-nvvp                 11.6.58                       0    nvidia/label/cuda-11.6.0
cuda-python               12.2.0                   pypi_0    pypi
cuda-runtime              11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-sanitizer-api        11.6.55                       0    nvidia/label/cuda-11.6.0
cuda-toolkit              11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-tools                11.6.0                        0    nvidia/label/cuda-11.6.0
cuda-visual-tools         11.6.0                        0    nvidia/label/cuda-11.6.0
cudatoolkit               8.0                           4    anaconda
cudnn                     7.1.4                 cuda8.0_0    anaconda
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
cython                    3.0.3                    pypi_0    pypi
eigen                     3.4.0                h91493d7_0    conda-forge
ffmpeg                    4.2.3                ha925a31_0    conda-forge
filelock                  3.12.4             pyhd8ed1ab_0    conda-forge
flatbuffers               23.5.26                  pypi_0    pypi
fonttools                 4.43.1          py311ha68e1ae_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
fsspec                    2023.4.0                 pypi_0    pypi
gast                      0.5.4                    pypi_0    pypi
gettext                   0.21.1               h5728263_0    conda-forge
glib                      2.78.0               h12be248_0    conda-forge
glib-tools                2.78.0               h12be248_0    conda-forge
google-auth               2.23.3                   pypi_0    pypi
google-auth-oauthlib      1.0.0                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
grpcio                    1.59.0                   pypi_0    pypi
gst-plugins-base          1.18.5               h9e645db_0
gstreamer                 1.18.5               hd78058f_0
h5py                      3.10.0                   pypi_0    pypi
hdf5                      1.12.1          nompi_h57737ce_104    conda-forge
icu                       58.2                 ha925a31_3
idna                      3.4                pyhd8ed1ab_0    conda-forge
intel-openmp              2023.2.0         h57928b3_50496    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
jpeg                      9e                   hcfcfb64_3    conda-forge
keras                     2.14.0                   pypi_0    pypi
kiwisolver                1.4.5           py311h005e61a_1    conda-forge
krb5                      1.21.2               heb0366b_0    conda-forge
lerc                      3.0                  hd77b12b_0
libbrotlicommon           1.1.0                hcfcfb64_1    conda-forge
libbrotlidec              1.1.0                hcfcfb64_1    conda-forge
libbrotlienc              1.1.0                hcfcfb64_1    conda-forge
libclang                  16.0.6                   pypi_0    pypi
libcublas                 11.8.1.74                     0    nvidia/label/cuda-11.6.0
libcublas-dev             11.8.1.74                     0    nvidia/label/cuda-11.6.0
libcufft                  10.7.0.55                     0    nvidia/label/cuda-11.6.0
libcufft-dev              10.7.0.55                     0    nvidia/label/cuda-11.6.0
libcurand                 10.2.9.55                     0    nvidia/label/cuda-11.6.0
libcurand-dev             10.2.9.55                     0    nvidia/label/cuda-11.6.0
libcurl                   8.4.0                hd5e4a3a_0    conda-forge
libcusolver               11.3.2.55                     0    nvidia/label/cuda-11.6.0
libcusolver-dev           11.3.2.55                     0    nvidia/label/cuda-11.6.0
libcusparse               11.7.1.55                     0    nvidia/label/cuda-11.6.0
libcusparse-dev           11.7.1.55                     0    nvidia/label/cuda-11.6.0
libdeflate                1.17                 h2bbff1b_1
libexpat                  2.5.0                h63175ca_1    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libglib                   2.78.0               he8f3873_0    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
libnpp                    11.6.0.55                     0    nvidia/label/cuda-11.6.0
libnpp-dev                11.6.0.55                     0    nvidia/label/cuda-11.6.0
libnvjpeg                 11.6.0.55                     0    nvidia/label/cuda-11.6.0
libnvjpeg-dev             11.6.0.55                     0    nvidia/label/cuda-11.6.0
libogg                    1.3.4                h8ffe710_1    conda-forge
libpng                    1.6.39               h19919ed_0    conda-forge
libprotobuf               3.20.3               h12be248_0    conda-forge
libsqlite                 3.43.2               hcfcfb64_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libtiff                   4.5.1                hd77b12b_0
libuv                     1.44.2               hcfcfb64_1    conda-forge
libvorbis                 1.3.7                h0e60522_0    conda-forge
libwebp                   1.3.2                hcfcfb64_1    conda-forge
libwebp-base              1.3.2                hcfcfb64_0    conda-forge
libxcb                    1.15                 hcd874cb_0    conda-forge
libxml2                   2.10.4               hc3477c8_0    conda-forge
libxslt                   1.1.37               h0192164_0    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markdown                  3.5                      pypi_0    pypi
markupsafe                2.1.3           py311ha68e1ae_1    conda-forge
matplotlib                3.8.0           py311h1ea47a8_2    conda-forge
matplotlib-base           3.8.0           py311h6e989c2_2    conda-forge
mkl                       2023.2.0         h6a75c08_50496    conda-forge
mkl-service               2.4.0           py311h2bbff1b_1
mkl_fft                   1.3.8           py311h2bbff1b_0
mkl_random                1.2.4           py311h59b6b97_0
ml-dtypes                 0.2.0                    pypi_0    pypi
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
networkx                  3.1                pyhd8ed1ab_0    conda-forge
ninja                     1.11.1               h91493d7_0    conda-forge
nsight-compute            2022.1.0.12                   0    nvidia/label/cuda-11.6.0
numpy                     1.26.0          py311hdab7c0b_0
numpy-base                1.26.0          py311hd01c5d8_0
nvidia-cuda-runtime-cu12  12.2.140                 pypi_0    pypi
oauthlib                  3.2.2                    pypi_0    pypi
opencv                    4.6.0           py311h5d08a89_5
openssl                   3.1.3                hcfcfb64_0    conda-forge
opt-einsum                3.3.0                    pypi_0    pypi
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pandas                    2.1.1           py311hf63dbb6_1    conda-forge
pcre2                     10.40                h17e33f8_0    conda-forge
pillow                    9.4.0           py311hd77b12b_1
pip                       23.3               pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
protobuf                  4.24.4                   pypi_0    pypi
pthread-stubs             0.4               hcd874cb_1001    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pyasn1                    0.5.0                    pypi_0    pypi
pyasn1-modules            0.3.0                    pypi_0    pypi
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.7          py311hd77b12b_0
pyqt5-sip                 12.11.0         py311hd77b12b_0
pysocks                   1.7.1              pyh0701188_6    conda-forge
python                    3.11.6          h2628c8c_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-tzdata             2023.3             pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pytorch                   2.1.0              py3.11_cpu_0    pytorch
pytorch-mutex             1.0                         cpu    pytorch
pytz                      2023.3.post1       pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py311ha68e1ae_1    conda-forge
qt-main                   5.15.2               he8e5bd7_7
qt-webengine              5.15.9               h5bd16bc_7
qtwebkit                  5.212                h2bbfb41_5
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
requests-oauthlib         1.3.1                    pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
sip                       6.6.2           py311hd77b12b_0
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.43.2               hcfcfb64_0    conda-forge
sympy                     1.12               pyh04b8f61_3    conda-forge
tbb                       2021.8.0             h59b6b97_0
tensorboard               2.14.1                   pypi_0    pypi
tensorboard-data-server   0.7.1                    pypi_0    pypi
tensorflow                2.14.0                   pypi_0    pypi
tensorflow-estimator      2.14.0                   pypi_0    pypi
tensorflow-intel          2.14.0                   pypi_0    pypi
tensorflow-io-gcs-filesystem 0.31.0                   pypi_0    pypi
termcolor                 2.3.0                    pypi_0    pypi
tk                        8.6.13               hcfcfb64_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
torchaudio                2.1.0                 py311_cpu    pytorch
torchvision               0.15.2          cpu_py311haf6e6b9_0
tornado                   6.3.3           py311ha68e1ae_1    conda-forge
tqdm                      4.66.1             pyhd8ed1ab_0    conda-forge
typing-extensions         4.8.0                hd8ed1ab_0    conda-forge
typing_extensions         4.8.0              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
urllib3                   2.0.6              pyhd8ed1ab_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hdcecf7f_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
werkzeug                  3.0.0                    pypi_0    pypi
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
win_inet_pton             1.1.0              pyhd8ed1ab_6    conda-forge
wrapt                     1.14.1                   pypi_0    pypi
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xz                        5.4.2                h8cc25b3_0
yaml                      0.2.5                h8ffe710_2    conda-forge
zlib                      1.2.13               hcfcfb64_5    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge

我如何使cuda工作
我试过修复
PyTorch Cuda with anaconda not available
我还尝试重新安装cudapytorch,并尝试在新的环境中使用不同版本的cudapytorch和python
但没有任何工作

eanckbw9

eanckbw91#

你的conda版本显示你已经安装了pytorch的CPU版本:

pytorch                   2.1.0              py3.11_cpu_0    pytorch
pytorch-mutex             1.0                         cpu    pytorch

您需要安装GPU版本。您可以找到正确的安装命令here

相关问题