简体   繁体   English

Python setup.py setuptools_scm use_scm_version/get_version() 错误

[英]Python setup.py setuptools_scm use_scm_version/get_version() error

Dear interent my docker build ( RUN python3 setup.py install ) continues to fail with the following error: LookupError: setuptools-scm was unable to detect version for '/src'.亲爱的,我的 docker build ( RUN python3 setup.py install ) 继续失败,并出现以下错误: LookupError: setuptools-scm was unable to detect version for '/src'. I know there are posts about this all over but I still can't sort it out.我知道到处都有关于这个的帖子,但我仍然无法整理出来。 Here's my repo:这是我的回购:

.
├── Dockerfile
├── VERSION  # a one-line file: 1.5.0
├── package
│   ├── __init__.py
│   ├── module.py
├── setup.py
└── .git

Here's my setup.py file:这是我的setup.py文件:

from setuptools import setup

setup_requirements = [
    'setuptools_scm==3.5.0',
    "Cython==0.29.24",
]
setup(
    ...
    use_scm_version=True,
    setup_requires=setup_requirements,
    ...
)

A couple notes:几点注意事项:

  1. If I run git describe i get the version i'm hoping use_scm_version finds: 1.5.0-rc.1如果我运行git describe我会得到我希望use_scm_version找到的版本: 1.5.0-rc.1
  2. If I comment out use_scm_version=True and instead use version=1.5.0 , it works perfectly如果我注释掉use_scm_version=True而是使用version=1.5.0 ,它可以完美运行

Thank you so much for any and all help, I'm so stuck.非常感谢您提供的所有帮助,我很困惑。 Cheers :)干杯:)

I have just stumbled in a very similar issue (and lost several hours on it...) on a CI pipeline that I maintain.我刚刚在我维护的 CI 管道上偶然发现了一个非常相似的问题(并且为此浪费了几个小时......)。

This is due to setuptools_scm silently ignoring a git error related to this git vulnerability fix release , see https://github.com/pypa/setuptools_scm/issues/707这是由于setuptools_scm默默地忽略了与此 git 漏洞修复版本相关的 git 错误,请参阅https://github.com/pypa/setuptools_scm/issues/707

Here is a (similar/duplicate) issue report that shows also how to diagnose the issue.是一个(类似/重复的)问题报告,它还显示了如何诊断问题。

Do you have git and the .git directory (metadata) along the package you are trying to build?您尝试构建的包中是否有 git 和 .git 目录(元数据)? setuptools-scm relies on either git (and an actual git checkout) or some metadata found in sdist archives. setuptools-scm 依赖于 git(和实际的 git checkout)sdist 档案中的一些元数据。 When both are unavailable, it complains as in the above.当两者都不可用时,它会像上面一样抱怨。 If you do not have any metadata in the build environment (such as when building packages with GNU Guix), you can placate setuptools-scm by exporting the SETUPTOOLS_SCM_PRETEND_VERSION to a version string of your choosing, and it'll use that.如果您在构建环境中没有任何元数据(例如使用 GNU Guix 构建软件包时),您可以通过将SETUPTOOLS_SCM_PRETEND_VERSION导出到您选择的版本字符串来安抚 setuptools-scm,它会使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到满足要求的版本 setuptools_scm<3,>=4.1.2 - ERROR: Could not find a version that satisfies the requirement setuptools_scm<3,>=4.1.2 如何在 setup.cfg 中指明 use_scm_version? - How to indicate use_scm_version in setup.cfg? setuptools_scm 可用时是否需要bumpversion(或bump2version)? - Is there a need for bumpversion (or bump2version) when setuptools_scm is available? 受Cython生成的C代码中的注释影响的setuptools_scm版本 - setuptools_scm version affected by comments in C code generated by Cython ReadTheDocs + Sphinx + setuptools_scm:怎么做? - ReadTheDocs + Sphinx + setuptools_scm: how to? setup.py:在尝试安装之前需要最新版本的setuptools - setup.py: require a recent version of setuptools before trying to install setup.py(setuptools)和源代码中的自动版本号? - Automatic version number both in setup.py (setuptools) AND source code? 如何在我的 package 中获取 setup.py (setuptools) 中定义的版本? - How can I get the version defined in setup.py (setuptools) in my package? setuptools_scm.version.SetuptoolsOutdatedWarning:您的setuptools太旧(&lt;12) - setuptools_scm.version.SetuptoolsOutdatedWarning: your setuptools is too old (<12) setuptools_scm 不适用于 `pip install.` 在父文件夹中的 git - setuptools_scm not working with `pip install .` in case of .git in parent folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM