没有提供tensorflow-2.10.0-cuda112py310he87a039_0所需的__cuda

Otá*_*lva 2 python conda tensorflow mamba mambaforge

我在启用的 WSL2 Ubuntu 22.04 上使用 mambaforge systemd。我尝试使用以下命令安装启用了 CUDA 的 TensorFlow 2.10:

\n
mamba install tensorflow\n
Run Code Online (Sandbox Code Playgroud)\n

WSL2 的命令nvidia-smi -q给出:

\n
==============NVSMI LOG==============\n\nTimestamp                                 : Sat Dec 17 23:22:43 2022\nDriver Version                            : 527.56\nCUDA Version                              : 12.0\n\nAttached GPUs                             : 1\nGPU 00000000:01:00.0\n    Product Name                          : NVIDIA GeForce RTX 3070 Laptop GPU\n    Product Brand                         : GeForce\n    Product Architecture                  : Ampere\n    Display Mode                          : Disabled\n    Display Active                        : Disabled\n    Persistence Mode                      : Enabled\n    MIG Mode\n        Current                           : N/A\n        Pending                           : N/A\n    Accounting Mode                       : Disabled\n    Accounting Mode Buffer Size           : 4000\n    Driver Model\n        Current                           : WDDM\n        Pending                           : WDDM\n    Serial Number                         : N/A\n    GPU UUID                              : GPU-f03a575d-7930-47f3-4965-290b89514ae7\n    Minor Number                          : N/A\n    VBIOS Version                         : 94.04.3f.00.d7\n    MultiGPU Board                        : No\n    Board ID                              : 0x100\n    Board Part Number                     : N/A\n    GPU Part Number                       : 249D-750-A1\n    Module ID                             : 1\n    Inforom Version\n        Image Version                     : G001.0000.03.03\n        OEM Object                        : 2.0\n        ECC Object                        : N/A\n        Power Management Object           : N/A\n    GPU Operation Mode\n        Current                           : N/A\n        Pending                           : N/A\n    GSP Firmware Version                  : N/A\n    GPU Virtualization Mode\n        Virtualization Mode               : None\n        Host VGPU Mode                    : N/A\n    IBMNPU\n        Relaxed Ordering Mode             : N/A\n    PCI\n        Bus                               : 0x01\n        Device                            : 0x00\n        Domain                            : 0x0000\n        Device Id                         : 0x249D10DE\n        Bus Id                            : 00000000:01:00.0\n        Sub System Id                     : 0x118C1043\n        GPU Link Info\n            PCIe Generation\n                Max                       : 3\n                Current                   : 3\n                Device Current            : 3\n                Device Max                : 4\n                Host Max                  : 3\n            Link Width\n                Max                       : 16x\n                Current                   : 8x\n        Bridge Chip\n            Type                          : N/A\n            Firmware                      : N/A\n        Replays Since Reset               : 0\n        Replay Number Rollovers           : 0\n        Tx Throughput                     : 0 KB/s\n        Rx Throughput                     : 0 KB/s\n        Atomic Caps Inbound               : N/A\n        Atomic Caps Outbound              : N/A\n    Fan Speed                             : N/A\n    Performance State                     : P8\n    Clocks Throttle Reasons\n        Idle                              : Active\n        Applications Clocks Setting       : Not Active\n        SW Power Cap                      : Not Active\n        HW Slowdown                       : Not Active\n            HW Thermal Slowdown           : Not Active\n            HW Power Brake Slowdown       : Not Active\n        Sync Boost                        : Not Active\n        SW Thermal Slowdown               : Not Active\n        Display Clock Setting             : Not Active\n    FB Memory Usage\n        Total                             : 8192 MiB\n        Reserved                          : 159 MiB\n        Used                              : 12 MiB\n        Free                              : 8020 MiB\n    BAR1 Memory Usage\n        Total                             : 8192 MiB\n        Used                              : 1 MiB\n        Free                              : 8191 MiB\n    Compute Mode                          : Default\n    Utilization\n        Gpu                               : 0 %\n        Memory                            : 0 %\n        Encoder                           : 0 %\n        Decoder                           : 0 %\n    Encoder Stats\n        Active Sessions                   : 0\n        Average FPS                       : 0\n        Average Latency                   : 0\n    FBC Stats\n        Active Sessions                   : 0\n        Average FPS                       : 0\n        Average Latency                   : 0\n    Ecc Mode\n        Current                           : N/A\n        Pending                           : N/A\n    ECC Errors\n        Volatile\n            SRAM Correctable              : N/A\n            SRAM Uncorrectable            : N/A\n            DRAM Correctable              : N/A\n            DRAM Uncorrectable            : N/A\n        Aggregate\n            SRAM Correctable              : N/A\n            SRAM Uncorrectable            : N/A\n            DRAM Correctable              : N/A\n            DRAM Uncorrectable            : N/A\n    Retired Pages\n        Single Bit ECC                    : N/A\n        Double Bit ECC                    : N/A\n        Pending Page Blacklist            : N/A\n    Remapped Rows                         : N/A\n    Temperature\n        GPU Current Temp                  : 46 C\n        GPU Shutdown Temp                 : 101 C\n        GPU Slowdown Temp                 : 98 C\n        GPU Max Operating Temp            : 87 C\n        GPU Target Temperature            : N/A\n        Memory Current Temp               : N/A\n        Memory Max Operating Temp         : N/A\n    Power Readings\n        Power Management                  : Supported\n        Power Draw                        : 12.08 W\n        Power Limit                       : 4294967.50 W\n        Default Power Limit               : 80.00 W\n        Enforced Power Limit              : 100.00 W\n        Min Power Limit                   : 1.00 W\n        Max Power Limit                   : 100.00 W\n    Clocks\n        Graphics                          : 210 MHz\n        SM                                : 210 MHz\n        Memory                            : 405 MHz\n        Video                             : 555 MHz\n    Applications Clocks\n        Graphics                          : N/A\n        Memory                            : N/A\n    Default Applications Clocks\n        Graphics                          : N/A\n        Memory                            : N/A\n    Deferred Clocks\n        Memory                            : N/A\n    Max Clocks\n        Graphics                          : 2100 MHz\n        SM                                : 2100 MHz\n        Memory                            : 6001 MHz\n        Video                             : 1950 MHz\n    Max Customer Boost Clocks\n        Graphics                          : N/A\n    Clock Policy\n        Auto Boost                        : N/A\n        Auto Boost Default                : N/A\n    Voltage\n        Graphics                          : 637.500 mV\n    Fabric\n        State                             : N/A\n        Status                            : N/A\n    Processes\n        GPU instance ID                   : N/A\n        Compute instance ID               : N/A\n        Process ID                        : 24\n            Type                          : G\n            Name                          : /Xwayland\n            Used GPU Memory               : Not available in WDDM driver model\n\n
Run Code Online (Sandbox Code Playgroud)\n

我的其他环境按预期工作:

\n
\xe2\xac\xa2 [Systemd] \xe2\x9d\xaf mamba activate tf\n\n~ via   tf via  774MiB/19GiB | 0B/5GiB\n\xe2\xac\xa2 [Systemd] \xe2\x9d\xaf python\nPython 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:45:29)\n[GCC 10.4.0] on linux\nType "help", "copyright", "credits" or "license" for more information.\n>>> import tensorflow as tf\n2022-12-17 23:25:13.867166: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  SSE4.1 SSE4.2 AVX AVX2 FMA\nTo enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n
Run Code Online (Sandbox Code Playgroud)\n

然后,它尝试安装软件包版本cuda112py39h9333c2f_1,winch使用Python 3.9,但我想要Python 3.10。每当我尝试安装 3.10 版本时,都会显示错误:

\n
Could not solve for environment specs\nEncountered problems while solving:\n  - nothing provides __cuda needed by tensorflow-2.10.0-cuda112py310he87a039_0\n\nThe environment can't be solved, aborting the operation\n
Run Code Online (Sandbox Code Playgroud)\n

为什么会出现此错误以及如何解决它?

\n

dav*_*dgd 8

我今天遇到了这个问题,找到了一个有效的解决方案(在看到你的 GitHub 帖子之后)。长话短说,您需要按照conda-forge 博客文章CONDA_OVERRIDE_CUDA中的描述来完成这项工作。

例如,对于 CUDA 11.8 和 mamba,请使用:

CONDA_OVERRIDE_CUDA="11.8" mamba install tensorflow -c conda-forge

对于 CUDA 11.8 和 conda,它将是:

CONDA_OVERRIDE_CUDA="11.8" conda install tensorflow -c conda-forge

根据您的设置,您可能还想安装 cudatoolkit,例如,

CONDA_OVERRIDE_CUDA="11.8" mamba install tensorflow cudatoolkit -c conda-forge

编辑:根据有用的评论修复了命令!

  • 添加对我有用的重要观察结果是环境变量“CONDA_OVERRIDE_CUDA”,而不是使用“mambaforge”的“CONDA_CUDA_OVERRIDE” (3认同)