version resolution errors when setuptools_scm is installed but lib5c is not installed in editable mode

Issue #77 resolved
Thomas Gilgenast created an issue

these cases are known to work as expected:

  1. install lib5c in editable mode, install setuptools-scm
  2. install lib5c normally, don’t install setuptools-scm

if lib5c is installed normally and setuptools-scm is present, then the current implementation of _version.py will first ask setuptools-scm for the version information, which will lead to the following stack trace:

Traceback (most recent call last):
...
  File "...\site-packages\lib5c\__init__.py", line 17, in <module>
    __version__ = get_version()
  File "...\site-packages\lib5c\_version.py", line 46, in get_version
    local_scheme=local_scheme
    return _get_version(config)
  File "...\site-packages\setuptools_scm\__init__.py", line 147, in _get_version
    parsed_version = _do_parse(config)
  File "...\site-packages\setuptools_scm\__init__.py", line 118, in _do_parse
    "use git+https://github.com/user/proj.git#egg=proj" % config.absolute_root
LookupError: setuptools-scm was unable to detect version for 'C:\\Users\\thoma\\venv\\lib\\site-packages'.

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

a workaround is to either uninstall setuptools-scm or reinstall lib5c in editable mode

a long term solution would be to catch this LookupError in _version.py and go to the next option (ask importlib.metadata for version info)

this bug also likely impacts hic3defdr since it also uses this implementation of _version.py

Comments (1)

  1. Log in to comment