如何在Google Colab中安装umap和umap.plot

4

很抱歉,我有一个问题需要请教,但我陷入了在GitHub问题讨论和!pip install...尝试之间的死循环。

问题是我无法在Google Colab中导入umap包,更具体地说,是umap.plot。起初,它给了我一个警告,说在安装umap之前,我需要安装holoviews、datashader和bokeh,并且我确保所有必需的包都已经安装好了。然而,尽管我已经安装了所有必要的包,但它仍然无法运行这个带有所有导入命令的单元格。因此,我改变了包的顺序,把umap放到最后,但这并没有帮助。事实上,突然间holoviews似乎成为了问题所在,尽管我似乎已经成功地安装了它。见右边的错误:

enter image description here

这是代码片段:

%autosave 0

import warnings; warnings.simplefilter('ignore')

import matplotlib.pyplot as plt

import pandas as pd
import numpy as np
import seaborn as sns

from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import NullFormatter

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn import manifold
from sklearn.utils import check_random_state

import holoviews
import datashader
import bokeh
from bokeh.plotting import show, save, output_notebook, output_file
from bokeh.resources import INLINE 

import umap
import umap.plot

plt.rcParams["figure.figsize"] = (20,10)

在更改安装包的顺序之前,这是原始错误消息:

enter image description here

1个回答

7

我刚刚运行了

!pip install umap-learn[plot]
!pip install holoviews
!pip install -U ipykernel

一切清晰明了!

这是从这里获取的。


1
Holoviews 1.13似乎与Colab存在冲突。您可能需要指定holoviews==1.12.7 - korakot

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接