question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Versioneer causes `fatal: bad revision 'HEAD'` under special circumstances

See original GitHub issue

The full story is available in https://github.com/datalad/datalad-osf/pull/100 and a tentative fix was proposed at https://github.com/datalad/datalad-osf/pull/100#issuecomment-650316993 by @kyleam

The summary is:

  • Deploying a Python package in editable fashion (pip install -e .) that installs a Git remote helper leads to unconditional fatal: bad revision 'HEAD' messages in boilerplate code.
  • ultimately this is due to an inadequate execution environment that versioneer is using to run Git commands
  • a minimal demo is contained in https://github.com/datalad/datalad-osf/pull/100#issuecomment-650316993

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
effigiescommented, Oct 6, 2020

It looks like a bad cmdclass here.

>>> import versioneer
>>> versioneer.get_cmdclass()
{'version': versioneer.get_cmdclass.<locals>.cmd_version,
 'build_py': versioneer.get_cmdclass.<locals>.cmd_build_py,
 'sdist': versioneer.get_cmdclass.<locals>.cmd_sdist}

What you probably want is something like:

cmdclass = versioneer.get_cmdclass()
cmdclass['build_ext'] = HelicsBuild

...
setup(
    ...
    cmdclass=cmdclass,
    ...
)

You should be able to see whether it’s working with something like:

$ python setup.py version 
running version
keywords are unexpanded, not using
got version from VCS {'version': '3.1.1+108.g7ce84f3e', 'full-revisionid': '7ce84f3e357dd39d280def45ce6b29c7f195e715', 'dirty': False, 'error': None, 'date': '2020-09-20T09:41:23-0400'}
Version: 3.1.1+108.g7ce84f3e
 full-revisionid: 7ce84f3e357dd39d280def45ce6b29c7f195e715
 dirty: False
 date: 2020-09-20T09:41:23-0400
0reactions
nightlarkcommented, Oct 9, 2020

Ahh, thanks! That actually helps a lot with understanding how cmdclass works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When importing helics in Python we get a git error message ...
Versioneer causes fatal: bad revision 'HEAD ' under special circumstances python-versioneer/python-versioneer#210.
Read more >
fatal: bad default revision 'HEAD' - git - Stack Overflow
We have it installed on one of our Linux boxes. Tortoise GIT is my windows client. This morning I checked in some changes,...
Read more >
versioneer — NiftyNet 0.6.0 documentation - Read the Docs
Debugging Versioneer tries to avoid fatal errors: if something goes wrong ... Known Limitations Some situations are known to cause problems for Versioneer....
Read more >
versioneer.py · master · mpm-at-recover / pycbg · GitLab
0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has ... Some situations are known to cause problems for...
Read more >
versioneer.py · master · Tantet Alexis (M.) / e4clim - Gitlab IN2P3
`_version.py` also contains `$Revision$` markers, ... Known Limitations Some situations are known to cause problems for Versioneer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found