gpt4 book ai didi

python - 找不到 'pynndescent' 分配,应用程序错误要求

转载 作者:行者123 更新时间:2023-12-05 06:02:37 27 4
gpt4 key购买 nike

我试图运行这个 tutorial并且它在“导入 cell2location”(单元格 3,第 15 行)上给出以下错误,

DistributionNotFound: The 'pynndescent' distribution was not found and is required by the application

site-packages 文件夹位于/usr/local/lib/python3.6 并且“pynndescent”已成功安装。 setup_colab.sh 脚本用于安装所有依赖项。脚本的内容是,

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
conda install -q -y --prefix /usr/local python=3.6 numpy pandas jupyter leidenalg python-
igraph scanpy louvain hyperopt loompy cmake nose tornado dill ipython bbknn seaborn
matplotlib request mkl-service pygpu theano --channel bioconda --channel conda-forge
pip install -q --prefix /usr/local plotnine pymc3
git clone https://github.com/BayraktarLab/cell2location.git cell2location_repo
cd cell2location_repo && pip install -q --prefix /usr/local .

脚本的输出可以在上面提供的 colab 链接中的 cell1 的输出中看到。完整的错误日志是,

---------------------------------------------------------------------------
DistributionNotFound Traceback (most recent call last)
<ipython-input-3-4cbed22293b5> in <module>()
13 #os.environ["THEANO_FLAGS"] = 'device=cpu,floatX=float32,openmp=True,force_device=True'
14
---> 15 import cell2location
16
17 import matplotlib as mpl

8 frames
/usr/local/lib/python3.6/site-packages/cell2location/__init__.py in <module>()
----> 1 from .region.spatial_knn import spot_factors2knn
2 from .run_c2l import run_cell2location
3 from .run_regression import run_regression
4 from .run_colocation import run_colocation
5

/usr/local/lib/python3.6/site-packages/cell2location/region/spatial_knn.py in <module>()
3 from scipy.spatial import cKDTree
4 from sklearn.neighbors import KDTree
----> 5 from umap.umap_ import fuzzy_simplicial_set
6
7

/usr/local/lib/python3.6/site-packages/umap/__init__.py in <module>()
1 from warnings import warn, catch_warnings, simplefilter
----> 2 from .umap_ import UMAP
3
4 try:
5 with catch_warnings():

/usr/local/lib/python3.6/site-packages/umap/umap_.py in <module>()
45 )
46
---> 47 from pynndescent import NNDescent
48 from pynndescent.distances import named_distances as pynn_named_distances
49 from pynndescent.sparse import sparse_named_distances as pynn_sparse_named_distances

/usr/local/lib/python3.6/site-packages/pynndescent/__init__.py in <module>()
6 numba.config.THREADING_LAYER = "workqueue"
7
----> 8 __version__ = pkg_resources.get_distribution("pynndescent").version

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in get_distribution(dist)
464 dist = Requirement.parse(dist)
465 if isinstance(dist, Requirement):
--> 466 dist = get_provider(dist)
467 if not isinstance(dist, Distribution):
468 raise TypeError("Expected string, Requirement, or Distribution", dist)

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
340 """Return an IResourceProvider for the named module or requirement"""
341 if isinstance(moduleOrReq, Requirement):
--> 342 return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
343 try:
344 module = sys.modules[moduleOrReq]

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in require(self, *requirements)
884 included, even if they were already activated in this working set.
885 """
--> 886 needed = self.resolve(parse_requirements(requirements))
887
888 for dist in needed:

/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
770 if dist is None:
771 requirers = required_by.get(req, None)
--> 772 raise DistributionNotFound(req, requirers)
773 to_activate.append(dist)
774 if dist not in req:

DistributionNotFound: The 'pynndescent' distribution was not found and is required by the application

我尝试重新安装 pynndescent、更新 setuptools、正确设置 PYTHONPATH,但都没有用。我该如何解决这个错误?

最佳答案

找到解决方案。在 setup_colab.sh 工作之前运行 !pip install pynndescent。有关更多信息,请参阅此 issue on github

关于python - 找不到 'pynndescent' 分配,应用程序错误要求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66886819/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com