如何在google平台-ai平台-notebook实例中安装库

How to install library in the google plat form - ai platform - notebook instance

本人目前是一名数据科学本科生,尝试使用google云平台-AI平台-notebook实例做数据科学项目。下图显示了我在说什么。




我没有问题运行实例并用它来操作数据。 但是,由于我想使用cudf库来加快数据处理速度,所以我需要安装那个库。 通过互联网搜索,我尝试过: 首先,我打开终端:



然后我尝试了以下命令并得到了错误:



命令来自这个website 2.Then 我尝试使用 anaconda 方式安装它,使用相同的方法 website 我在终端中输入以下命令并获得了 'UnsatisfiableError'。



从上面可以看出,10.0版和9.42版我都试过了,但是都不行。 3. 然后我也尝试使用website中的方法。我在终端输入以下命令 conda install -c nvidia -c rapidsai -c numba -c conda-forge -c defaults cudf=0.8 python=3.6 cudatoolkit=9.2,结果很长所以我只显示最后一部分:



可以看到,这次安装成功了。但是当我打开一本新的笔记本并导入 'cudf' 库时,出现以下错误:



说没有这个库,我刚安装了这个库

我真的很感谢能为我解决这个问题的人,因为我已经为此苦苦挣扎了 7 个小时。

为了在 AI 平台笔记本中安装依赖项,你确实应该使用 pip(看看这个 link)。 但是,似乎RAPIDS is not working anymore with PIP installation packages and therefore the proper approach to install it is by creating a Docker image or installing it using conda. In their GitHub Library您可以看到更多关于如何操作的信息。

In this link you will find the Rapids Docker repository where you can pull a Docker image with the required dependencies to run cuDF and here 您将找到使用自定义容器创建 AI Platform Notebook 实例的步骤。

由于AI平台notebooks处于Beta阶段,可能还没有安装conda包的功能。

作为解决方法,我建议您在笔记本 运行“PyTorch”环境中安装 cuDF 包,而不是您使用的“Numpy/SciPy/scikit-learn”,因为它的默认 pip 版本较旧(19.1 .1).为此,您可以查看此 link 并查看如何设置“PyTorch”环境。