Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flit-scm-py fails to build with LookupError: setuptools-scm was unable to detect version #1220

Open
dhomeier opened this issue Feb 17, 2025 · 10 comments
Assignees
Labels

Comments

@dhomeier
Copy link
Contributor

Full traceback

PYTHONPATH=/opt/sw4/share/bootstrap-modules-python310 /opt/sw4/bin/python3.10 -m build --wheel --no-isolation --skip-dependency-check
* Building wheel...
Traceback (most recent call last):
  File "/opt/sw4/share/bootstrap-modules-python310/pyproject_hooks/_in_process/_in_process.py", line 373, in <module>
    main()
  File "/opt/sw4/share/bootstrap-modules-python310/pyproject_hooks/_in_process/_in_process.py", line 357, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
  File "/opt/sw4/share/bootstrap-modules-python310/pyproject_hooks/_in_process/_in_process.py", line 271, in build_wheel
    return _build_backend().build_wheel(
  File "/opt/sw4/share/bootstrap-modules-python310/pyproject_hooks/_in_process/_in_process.py", line 70, in _build_backend
    obj = import_module(mod_path)
  File "/opt/sw4/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/sw4/src/fink.build/flit-scm-py310-1.7.0-1/flit_scm-1.7.0/flit_scm/__init__.py", line 21, in <module>
    get_version(**setuptools_scm_config)
  File "/opt/sw4/share/bootstrap-modules-python310/setuptools_scm/__init__.py", line 148, in get_version
    _version_missing(config)
  File "/opt/sw4/share/bootstrap-modules-python310/setuptools_scm/__init__.py", line 108, in _version_missing
    raise LookupError(
LookupError: setuptools-scm was unable to detect version for /opt/sw4/src/fink.build/flit-scm-py310-1.7.0-1/flit_scm-1.7.0.

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.

For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj

ERROR Backend subprocess exited when trying to invoke build_wheel

The error message seems quite nonsensical since this is the PyPI tarball, with a complete PKG-INFO and current flit_scm/._version.py in fact. As the last update upstream was "support setuptools_scm >= 6.4", I have also tried downgrading those from 7.1.0 to 6.4.2, but with the same failure.
Running from setuptools_scm import get_version; get_version() directly in the source dir produces the same result; it's totally unclear to me why the package tries to enforce getting a setuptools_scm version when the _version.py file already exists...

bootstrap-modules-py310 20241126-2
Package manager version: 0.45.99.git
Distribution version: selfupdate-point (bootstrap), 15.0, arm64
Trees: local/main stable/main
Xcode.app: 16.2
Xcode command-line tools: 16.2.0.0.1.1733547573
Max. Fink build jobs: 8

@dhomeier
Copy link
Contributor Author

I could get the wheel build and install to work by removing the [tool.setuptools_scm] section from pyproject.toml, which lets it pass onto using the existing flit_scm/_version.py.

@nieder
Copy link
Member

nieder commented Feb 17, 2025

I got nothing. My only suggestion would have been to downgrade setuptools-scm, but you already tried that.

@dhomeier
Copy link
Contributor Author

With what Python and Distribution does it build for you?
My guess was that the source package uploaded to PyPI is broken, but installing directly from there with pip install --no-build-isolation --no-binary builds the wheel successfully; unfortunately I could not get pip to echo exactly what commands it's using for that.

@nieder
Copy link
Member

nieder commented Feb 18, 2025

This is on 10.14.6

nieder $ ls -l flit-scm-py3*
-rw-r--r--  1 root  wheel  4764 Jul  1  2023 flit-scm-py310_1.7.0-1_darwin-x86_64.deb
-rw-r--r--  1 root  wheel  4732 Feb  9  2024 flit-scm-py37_1.7.0-1_darwin-x86_64.deb
-rw-r--r--  1 root  wheel  4736 Jul  1  2023 flit-scm-py38_1.7.0-1_darwin-x86_64.deb
-rw-r--r--  1 root  wheel  4758 Jul  1  2023 flit-scm-py39_1.7.0-1_darwin-x86_64.deb

So I was able to build it 1.5 years ago. And trying now also succeeds on py38 but fails on py310:

flit_scm-1.7.0/pyproject.toml
flit_scm-1.7.0/PKG-INFO
sudo -u fink-bld [ENV] sh -c /tmp/fink.ksajQ
PYTHONPATH=/sw/share/bootstrap-modules-python38 /sw/bin/python3.8 -m build --wheel --no-isolation --skip-dependency-check
* Building wheel...
Successfully built flit_scm-1.7.0-py3-none-any.whl
phase test: passed
/bin/rm -rf /sw/build.build/root-flit-scm-py38-1.7.0-1
/bin/mkdir -p /sw/build.build/root-flit-scm-py38-1.7.0-1/sw
/bin/mkdir -p /sw/build.build/root-flit-scm-py38-1.7.0-1/DEBIAN

I recently uninstalled all my py310 mods for testing, so there's a lot more junk in my py38 install that could be a missing BDep.

@nieder
Copy link
Member

nieder commented Feb 18, 2025

py37 also fails for me.

Then testing things, if I have bootstrap-modules-py310-20241126-2 (latest), py310 fails. If I downgrade to 20241126-1 (or any of the 20221003 debs) it works.

The changes between 20241126-1 and 20241126-2 are things like this, with versioning added to the dist-info directory when needed.

-    5141 2024-11-28 06:03 ./sw/share/bootstrap-modules-python310/pyparsing.dist-info/METADATA
+    5141 2024-12-04 04:31 ./sw/share/bootstrap-modules-python310/pyparsing-3.1.4.dist-info/METADATA

I would think that helps builds...

@dhomeier
Copy link
Contributor Author

I confirm that building the py38 and py39 versions succeeds with bootstrap-modules-py3N-20241126-2 installed.
py310 still fails after downgrading to bootstrap-modules-py310-20241126-1, but builds with 20221003-3 or earlier.

@nieder
Copy link
Member

nieder commented Feb 18, 2025

This makes me think that there's some interplay between unknown pymods affecting the version detection. flit-scm has fairly simple dependencies: https://gitlab.com/WillDaSilva/flit_scm/-/blob/main/pyproject.toml?ref_type=heads#L35-39

I do notice that it calls for flit-core ~= 3.5, while ours is currently at 3.9.0 both in standalone and in bootstrap-modules. However, the 20221103 bootstrap-modules was at flit-core=3.7.1, which technically also doesn't satisfy the upsteam ~=3.5 requires.

@dhomeier
Copy link
Contributor Author

dhomeier commented Feb 19, 2025

I do notice that it calls for flit-core ~= 3.5, while ours is currently at 3.9.0 both in standalone and in bootstrap-modules. However, the 20221103 bootstrap-modules was at flit-core=3.7.1, which technically also doesn't satisfy the upsteam ~=3.5 requires.

The pip install specifies flit-core ~= 3.5 as well, yet is building successfully with 3.10 installed.

Other datapoints with bootstrap-modules >= 20241126:

  • building exceptiongroup-py310 fails with a similar LookupError with either patched or unpatched flit-scm as well
  • pytest-7.4.4 fails on
`bdist_wheel` [no longer]

> PYTHONPATH=/opt/sw4/share/bootstrap-modules-python310 /opt/sw4/bin/python3.10 -m build --wheel --no-isolation --skip-dependency-check > Building wheel... usage: _in_process.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: _in_process.py --help [cmd1 cmd2 ...] or: _in_process.py --help-commands or: _in_process.py cmd --help

error: invalid command 'bdist_wheel'

ERROR Backend subprocess exited when trying to invoke build_wheel

@nieder
Copy link
Member

nieder commented Feb 19, 2025

The bdist_wheel problem should have been taken care of by 9a745e0

@dhomeier
Copy link
Contributor Author

Right; I had previously rebuilt bootstrap-modules to the prior commit, which had the same revision. With the entry_points.txt included, pytest build succeeds, but the same failure on exceptiongroup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants