You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Colab中RAPIDS组件pip安装失败问题求助

问题描述

在Google Colab的Jupyter Notebook中尝试通过以下pip命令安装RAPIDS库:

pip install cudf-cu11 dask-cudf-cu11 --extra-index-url=https://pypi.ngc.nvidia.com
pip install cuml-cu11 --extra-index-url=https://pypi.ngc.nvidia.com
pip install cugraph-cu11 --extra-index-url=https://pypi.ngc.nvidia.com

Colab分配的机器配置:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03    Driver Version: 510.47.03    CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
| N/A   40C    P0    26W /  70W |      0MiB / 15360MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

执行每条命令时均出现以下错误:

Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/, https://pypi.ngc.nvidia.com
Collecting cudf-cu11
  Using cached cudf_cu11-23.2.0.tar.gz (6.5 kB)
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
解决方案

1. 清理pip缓存,避免拉取源码包

错误显示pip使用了缓存的源码包(.tar.gz格式)而非预编译的wheel文件,这是导致元数据生成失败的核心原因之一。先清理pip缓存:

pip cache purge

2. 使用RAPIDS官方Colab安装脚本

RAPIDS提供了专为Colab优化的安装脚本,会自动匹配CUDA版本、处理依赖冲突,无需手动指定单个包。执行以下命令:

!pip install -q rapidsai-colab
!python -m rapidsai_colab install

该脚本会自动安装适配CUDA 11.6的cudf、cuml、cugraph等全套RAPIDS组件。

3. 验证安装有效性

安装完成后,运行以下代码确认:

import cudf
import cuml
import cugraph

print("cudf version:", cudf.__version__)
print("cuml version:", cuml.__version__)
print("cugraph version:", cugraph.__version__)

若能正常输出版本号,说明安装成功。

额外说明

  • 手动指定cu11后缀包时,需严格匹配包版本与Colab的CUDA版本,RAPIDS 23.2虽支持CUDA 11.6,但Colab的pip源优先级问题可能导致拉取源码包而非预编译wheel。
  • 官方安装脚本是Colab环境下部署RAPIDS的推荐方式,能规避大部分版本兼容问题。

内容的提问来源于stack exchange,提问作者Ric SG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 10:26:03