setuptools-scm: setuptools_scm breaks pip installing subdirs from git
For example: pip install 'git+https://github.com/swift-nav/libsbp#subdirectory=python'
pip clones the entire repo, including the .git dir, but setuptools_scm breaks
Collecting git+https://github.com/swift-nav/libsbp#subdirectory=python
Cloning https://github.com/swift-nav/libsbp to /tmp/jck/pip-pjPlzH-build
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/jck/pip-pjPlzH-build/python/setup.py", line 55, in <module>
zip_safe=False)
File "/usr/lib64/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/home/jck/.local/share/virtualenvs/a990cbf97408406/lib/python2.7/site-packages/setuptools/dist.py", line 323, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/home/jck/.local/share/virtualenvs/a990cbf97408406/lib/python2.7/site-packages/setuptools/dist.py", line 392, in finalize_options
ep.load()(self, ep.name, value)
File "/tmp/jck/pip-pjPlzH-build/python/.eggs/setuptools_scm-1.15.6-py2.7.egg/setuptools_scm/integration.py", line 22, in version_keyword
File "/tmp/jck/pip-pjPlzH-build/python/.eggs/setuptools_scm-1.15.6-py2.7.egg/setuptools_scm/__init__.py", line 119, in get_version
File "/tmp/jck/pip-pjPlzH-build/python/.eggs/setuptools_scm-1.15.6-py2.7.egg/setuptools_scm/__init__.py", line 97, in _do_parse
LookupError: setuptools-scm was unable to detect version for '/tmp/jck/pip-pjPlzH-build/python'.
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
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/jck/pip-pjPlzH-build/python
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 6
- Comments: 15 (8 by maintainers)
I have the same issue here. In my setup.py:
Running
python setup.py --versionafter git clone is working properly. Trying to install using pip with subdirectory is failling. Little digging with the /tmp directory reveal it’s cause by the creation ofpip-egg-infodirectory. When the directory exists, it fail like this:If the directory exists,
rootparameter pass touse_scm_versionis discarded and the version is not resolved. Issue is aroundintegration.py:Since a fallback is found, the pop the
rootarguments. Not sure to understand the logic. As soon the directory ‘pip-egg-info’ exists, it’s “matching”. The entry point is not execute. To work around this issue, I downgrade the version to 1.5.0 as follow:It is still possible to workaround this issue without downgrading
setuptools_scm. It works for me with the following setup (setup.pyis one level deeper than repository root)Please let me know if this solution has any drawbacks.
If I’m right above, probably not? Though it might be reasoanble to copy the parent directory too and just CD into the sub directory-- but we’d have to verify that is actually the case.