setuptools-scm was unable to detect version for'.../../某git包'
-
你好小鱼,我在安装好的pytorch环境下按照readme运行了在github上下载的一个程序包,还没运行起来就卡在了第一步,运行setup.py install 时出现如下错误
LookupError: setuptools-scm was unable to detect version for '/home/wxy/mypython/grasp_det_seg_cnn'. Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
困住了我两天了,在网上查找原因少之又少,应该是setuptools-scm获取python version的问题,奈何自己学识尚浅,不会修改,烦请小鱼帮忙看一下。我得设备版本如下:
ubuntu:18.04 python:3.9 pytorch:1.11.0 cuda:10.1 setuptools:33.1.1 setuptools:1.15.0
其中,git包文件如下:
setup.pyfrom os import path, listdir import setuptools from torch.utils.cpp_extension import BuildExtension, CUDAExtension def find_sources(root_dir): sources = [] for file in listdir(root_dir): _, ext = path.splitext(file) if ext in [".cpp", ".cu"]: sources.append(path.join(root_dir, file)) return sources def make_extension(name, package): return CUDAExtension( name="{}.{}._backend".format(package, name), sources=find_sources(path.join("src", name)), extra_compile_args={ "cxx": ["-O3"], "nvcc": ["--expt-extended-lambda"], }, include_dirs=["include/"], ) here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() setuptools.setup( # Meta-data name="GraspDetSeg_CNN", author="Stefan Ainetter", author_email="stefan.ainetter@icg.tugraz.at", description="Grasp Detection and Segmentation for Pytorch, code based on Seamless Scene Segmentation (https://github.com/mapillary/seamseg).", long_description_content_type="text/markdown", url="", classifiers=[ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", ], # Versioning use_scm_version={"root": ".", "relative_to": __file__, "write_to": "grasp_det_seg/_version.py"}, # Requirements setup_requires=["setuptools_scm"], python_requires=">=3, <4", # Package description packages=[ "grasp_det_seg", "grasp_det_seg.algos", "grasp_det_seg.config", "grasp_det_seg.data_OCID", "grasp_det_seg.models", "grasp_det_seg.modules", "grasp_det_seg.modules.heads", "grasp_det_seg.utils", "grasp_det_seg.utils.bbx", "grasp_det_seg.utils.nms", "grasp_det_seg.utils.parallel", "grasp_det_seg.utils.roi_sampling", ], ext_modules=[ make_extension("nms", "grasp_det_seg.utils"), make_extension("bbx", "grasp_det_seg.utils"), make_extension("roi_sampling", "grasp_det_seg.utils") ], cmdclass={"build_ext": BuildExtension}, include_package_data=True, )
_version.py
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '0.1.dev0' version_tuple = (0, 1, 'dev0')
init.py
from ._version import version as __version__
麻烦小鱼抽空看一下,感激不尽!
-
@904048425 别点名让我回答哇⊙∀⊙!不然小鱼累死也回答不完
,社区建设要靠大家哈。
对于没人回答的问题,小鱼会统一时间回复的。 -
@小鱼 好的好的,不好意思呀,我是我是没几个月的新粉,头一次来社区,以为都是小鱼大佬在回答呢,不着急,我先干别的活
-
@904048425 刚刚仔细看了下,看不出具体原因,这个要结合错误日志打印具体分析,比较困难。你有尝试过其他版本的Python吗?
看到setup.py中有这个一段,不知道是否有所影响。
classifiers=[ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", ],
-
@小鱼 我的Cuda 对应的是py39的,所以我在您提出的代码中加了39的项,仍然出错,因为别的版本的py没有安装cuda ,所以我没有试其他版本的python
-
@904048425 你要装的是什么包,到github的issue翻找一下,应该不止你一个人遇到这个问题。
-
@小鱼 好的,我再去看看
-
@904048425 大佬我想问下你解决了吗,我也是想测试这个机器人抓取的代码,也卡在了这里, 呜呜呜