setuptools_scm: Issue with 'hg was not found'
Hello, I’m getting this error:
docs: packaging backend failed (code=1), with OSError: 'hg' was not found Traceback (most recent call last): File "C:\Users\yyyyyy\AppData\Roaming\Python\Python310\site-packages\pyproject_api\_backend.py", line 90, in run outcome = backend_proxy(parsed_message["cmd"], **parsed_message["kwargs"]) File "C:\Users\yyyyyy\AppData\Roaming\Python\Python310\site-packages\pyproject_api\_backend.py", line 32, in __call__ return getattr(on_object, name)(*args, **kwargs) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\build_meta.py", line 380, in prepare_metadata_for_build_wheel self.run_setup() File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super(_BuildMetaLegacyBackend, File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\build_meta.py", line 338, in run_setup exec(code, locals()) File "<string>", line 18, in <module> File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\__init__.py", line 107, in setup return distutils.core.setup(**attrs) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\_distutils\core.py", line 147, in setup _setup_distribution = dist = klass(attrs) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\dist.py", line 496, in __init__ _Distribution.__init__( File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\_distutils\dist.py", line 283, in __init__ self.finalize_options() File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\dist.py", line 935, in finalize_options ep(self) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools\dist.py", line 955, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\integration.py", line 91, in version_keyword _assign_version(dist, config) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\integration.py", line 60, in _assign_version maybe_version = _get_version(config) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\__init__.py", line 153, in _get_version parsed_version = _do_parse(config) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\__init__.py", line 100, in _do_parse version = _version_from_entrypoints(config) or _version_from_entrypoints( File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\_entrypoints.py", line 66, in _version_from_entrypoints version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load()) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\_entrypoints.py", line 40, in _call_entrypoint_fn return fn(root, config=config) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\hg.py", line 164, in parse wd = HgWorkdir.from_potential_worktree(config.absolute_root) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\hg.py", line 29, in from_potential_worktree require_command(cls.COMMAND) File "D:\Test\tester\xxxxxxxxxxx\.tox\.pkg\lib\site-packages\setuptools_scm\utils.py", line 171, in require_command raise OSError("%r was not found" % name) OSError: 'hg' was not found Backend: run command prepare_metadata_for_build_wheel with args {'metadata_directory': 'D:\\Test\\tester\\xxxxxxxxxxx\\.tox\\.pkg\\.meta', 'config_settings': {'--build-option': []}} Backend: Wrote response {'code': 1, 'exc_type': 'OSError', 'exc_msg': "'hg' was not found"} to C:\Users\yyyyyy\AppData\Local\Temp\pep517_prepare_metadata_for_build_wheel-on2nznbh.json
Notes:
Python 3.10.6
hg is installed at C:\Program Files\TortoiseHg
Tried cloning project again
Reinstalling python
Reinstalling all dependencies to tox
Removed .tox folder in users folder
Tried reinstalling THG
If i separate the require_comman from the package and run it in pycharm scratch file it finds hg without a problem.
Anyone have any idea what could be wrong? I’ve seen the same issue in other packages so it is not related to the package. Even got collogues with the same issue. I sadly cannot remember what i did to cause the issue.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 34 (14 by maintainers)
I’m making a stab here, except my project has nothing to with HG whatsoever (other than the error message at the end of the traceback). I’m assuming the
hg
bit somehow gets invoked because the error starts with the “pretending there aren’t any (git files)” as shown here:The above error is sporadic and only happens on Windows in Github CI. If I go re-run the failed job in the Github GUI it will almost certainly succeed. The above failed job is here: https://github.com/sarnold/procman/actions/runs/6293550384/job/17084214891?pr=3
I don’t have an answer but hopefully this adds another piece to the picture.