如何解决未找到“pynndescent”分布,应用程序错误需要此分布
我试图运行这个 tutorial,它在“import cell2location”(单元格 3,第 15 行)上出现以下错误,
distributionNotFound:未找到“pynndescent”分发版,应用程序需要此分发版
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。