2

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'. 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:

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
  2. If I comment out use_scm_version=True and instead use version=1.5.0, it works perfectly

Thank you so much for any and all help, I'm so stuck. Cheers :)

Oliver
  • 281
  • 3
  • 14

2 Answers2

1

I have just stumbled in a very similar issue (and lost several hours on it...) on a CI pipeline that I maintain.

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

Here is a (similar/duplicate) issue report that shows also how to diagnose the issue.

charlie80
  • 806
  • 1
  • 7
  • 17
0

Do you have git and the .git directory (metadata) along the package you are trying to build? setuptools-scm relies on either git (and an actual git checkout) or some metadata found in sdist archives. 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.

Apteryx
  • 5,822
  • 3
  • 16
  • 18