Closed GiovanniBussi closed 6 years ago
Annoying. What exactly does not work? An alternative is just to reintroduce the version number explicitly in the setup.py file - although the double representation is a little ugly.
On 20 February 2018 at 11:43, Giovanni notifications@github.com wrote:
Inferring the version with setuptools_scm makes it impossible to work with git archives (that is: what you download as a release from github). This is a known problem of setuptools_scm.
Here's a possible solution: https://github.com/Changaco/se tuptools_scm_git_archive
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/srnas/barnaba/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8sB1JR2DiapZAx-jVkMi7utJVCY4kTks5tWqHRgaJpZM4SLvjw .
I noticed it setting up stuff for MacPorts, which by default downloads from a github archive. I have a workaround for that, which however is not completely satisfactory (I have to tell MacPorts to download directly from git, which makes it not able to cache the distfile). Anyway, all of this is pretty much MacPorts related and could be fixed in other ways.
The main symptom is the following:
barnaba-0.1.4.tar.gz
)Try to install it with pip install --user .
On my laptop I get the following error:
macbook: barnaba-0.1.4$ pip-2.7 install --user .
Processing /Users/bussi/Downloads/barnaba-0.1.4
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/jp/jvl3kcrx7xx6wr1klch94xmw0000gn/T/pip-fSBwJP-build/setup.py", line 33, in <module>
zip_safe=False)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/dist.py", line 333, in __init__
_Distribution.__init__(self, attrs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/dist.py", line 476, in finalize_options
ep.load()(self, ep.name, value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools_scm/integration.py", line 22, in version_keyword
dist.metadata.version = get_version(**value)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools_scm/__init__.py", line 119, in get_version
parsed_version = _do_parse(root, parse)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools_scm/__init__.py", line 97, in _do_parse
"use git+https://github.com/user/proj.git#egg=proj" % root)
LookupError: setuptools-scm was unable to detect version for '/private/var/folders/jp/jvl3kcrx7xx6wr1klch94xmw0000gn/T/pip-fSBwJP-build'.
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 /private/var/folders/jp/jvl3kcrx7xx6wr1klch94xmw0000gn/T/pip-fSBwJP-build/
The reason is actually straightforward: there is no version information stored in the tar.gz. The package I mentioned above (https://github.com/Changaco/setuptools_scm_git_archive) recommends creating a file that is changed by git upon export and that can then be used as a version number. Maybe with some python knowledge it is easy to modify setup.py so that the extra package is not even needed.
A small update on this. I found out that MacPorts can also download directly from pypi (see here) so I think it will be easy to maintain the Portfile. So, from the MacPorts file the issue is solved.
So, the correct ways to install barnaba are:
git clone
and pip install -e
.People trying to install from the tarball would see the mysterious error above. I will add a comment in the README file.
Great that you found a solution! For future reference: if this issue ever turns up again in a different setting, we should just go back to representing the version number explicitly in setup.py
.
Inferring the version with setuptools_scm makes it impossible to work with git archives (that is: what you download as a release from github). This is a known problem of setuptools_scm.
Here's a possible solution: https://github.com/Changaco/setuptools_scm_git_archive