[英]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:几点注意事项:
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
use_scm_version=True
and instead use version=1.5.0
, it works perfectlyuse_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.