hatch-vcs icon indicating copy to clipboard operation
hatch-vcs copied to clipboard

Fallbacks when `git` command not found

Open awgymer opened this issue 1 year ago • 4 comments

This may be more of a setuptools-scm question but I am not sure.

I was trying to do an editable install (pip install -e .) inside a docker container that didn't have git installed and I get:

WARNING setuptools_scm.run_cmd command git missing: [Errno 2] No such file or directory: 'git'
ERROR setuptools_scm._get_version_impl command git not found while parsing the scm, using fallbacks
Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, in prepare_metadata_for_build_editable
          hook = backend.prepare_metadata_for_build_editable
      AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'

During handling of the above exception, another exception occurred:
      
Traceback (most recent call last):
...
setuptools_scm._run_cmd.CommandNotFoundError: git
      Traceback (most recent call last):
...
 LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /code.

(I can provide more of the traceback if necessary)

It's a bit counterintuitive because the initial error appears to be that git is not found but then it suggests it is falling back to something in hatchling but then that errors. Then the bottom line error is somewhat vague about the cause of the failure to find the version.

I'm not clear what the fallbacks are intended to be, or whether using setuptools-scm is even possible if git (or hg) is not available?

NB: For clarity, the .git folder is present in the /code folder.

awgymer avatar Jan 04 '24 12:01 awgymer