pypa / setuptools-scm

the blessed package to manage your versions by scm tags
https://setuptools-scm.readthedocs.io/en/latest/
MIT License
860 stars 211 forks source link

LookupError: setuptools-scm was unable to detect version #278

Closed marcelotrevisani closed 6 years ago

marcelotrevisani commented 6 years ago

Hi, I'm trying to use setuptools_scm in a project. However, I'm facing this error:

Traceback (most recent call last):
  File "setup.py", line 25, in <module>
    'projectgui.project.dialog': ["*.ui"],
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/__init__.py", line 131, in setup
    return distutils.core.setup(**attrs)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/dist.py", line 370, in __init__
    k: v for k, v in attrs.items()
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/dist.py", line 529, in finalize_options
    ep.load()(self, ep.name, value)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools_scm/integration.py", line 22, in version_keyword
    dist.metadata.version = get_version(**value)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools_scm/__init__.py", line 119, in get_version
    parsed_version = _do_parse(root, parse)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/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 '/home/trevisan/project/Framework/src/pythonGui'.

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

I cloned this project from a private gitlab repository, I don't know if it is the problem. In setup.py I added:

setup(
...
    setup_requires=['setuptools_scm'],
    use_scm_version={'write_to': 'project/_version.py'},
...
)

I'm using setuptools_scm 2.1.0

RonnyPfannschmidt commented 6 years ago

whats the output of git tag and git status and git describe

marcelotrevisani commented 6 years ago

Output git tag

1.0.0
1.0.1
1.0.2
1.0.3
1.1.0
1.1.1
1.1.2
1.1.3
1.2.0
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.2.rc0
1.2.rc1
1.2.rc2
1.3.0
1.3.1
1.3.10
1.3.11
1.3.12
1.3.2
1.3.3
1.3.4
1.3.5
1.3.6
1.3.7
1.3.8
1.3.9
1.4.0
1.4.1
1.4.2
1.4.3
1.4.4
1.4.5
1.4.6
1.4.6pre1
1.4.6pre2
1.4.7
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
2.0.5
2.0.6
2.0.7
2.0.8
2.1.0
2.1.1
2.1.10
2.1.11
2.1.12
2.1.12a1
2.1.12rc1
2.1.13
2.1.13.1
2.1.13rc1
2.1.13rc2
2.1.13rc4
2.1.14
2.1.14.1
2.1.14rc1
2.1.14rc2
2.1.14rc3
2.1.15
2.1.15.1
2.1.15.2
2.1.15rc1
2.1.15rc2
2.1.15rc3
2.1.16
2.1.16.1
2.1.16.2
2.1.16.3
2.1.16.4
2.1.16rc1
2.1.16rc2
2.1.16rc3
2.1.17
2.1.18
2.1.18.1
2.1.18.2
2.1.18.3
2.1.18.4
2.1.18.5
2.1.18a1
2.1.18a2
2.1.18a3
2.1.18rc1
2.1.18rc2
2.1.18rc3
2.1.18rc4
2.1.18rc5
2.1.18rc6
2.1.18rc7
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.6-LPD
2.1.7
2.1.8
2.1.9
2.2.0
2.2.0rc1
2.2.0rc10
2.2.0rc2
2.2.0rc3
2.2.0rc4
2.2.0rc5
2.2.0rc6
2.2.0rc7
2.2.0rc8
2.2.0rc9
2.2.1
2.2.1rc1
2.2.1rc2
2.2.2
2.2.2.1
2.2.2.2
2.2.2.rc10
2.2.2rc1
2.2.2rc2
2.2.2rc3
2.2.2rc4
2.2.2rc5
2.2.2rc6
2.2.2rc7
2.2.2rc8
2.2.2rc9
2.2.3
2.2.3.1
2.2.3.2
2.2.3.3
2.2.3.3a1
2.2.3.4
2.2.3.5
2.2.3.6
2.2.3rc1
2.2.3rc2
2.2.3rc3
2.2.3rc4
2.2.3rc5
2.2.3rc6
2.2.3rc7
2.2.3rc8
2.2.3rc9
2.2.4
2.2.4.1
2.2.4a1
2.2.4rc1
2.2.4rc10
2.2.4rc11
2.2.4rc12
2.2.4rc13
2.2.4rc14
2.2.4rc2
2.2.4rc3
2.2.4rc4
2.2.4rc5
2.2.4rc6
2.2.4rc7
2.2.4rc8
2.2.4rc9
EndOfTrunk
deps-add-boost-coro-ctxt
deps-add-coverage-4.5.1
deps-add-daemontools
deps-add-eXistDB
deps-add-eulexistdb
deps-add-libzmq
deps-add-psutil
deps-add-pyyaml-3.12
deps-daemontools-encore
deps-daemontools-restart-patch
deps-daemontools-status
deps-eXistDB-bindist-install
deps-eXistDB-java-install
deps-eulxml-yacc-patch
deps-existdb-install-once
deps-flake8
deps-initial
deps-msgpack-python
deps-openmq-cleanup
deps-openmq-lclbrk-config
deps-pyzmq
deps-quadmath
deps-relocateable-sip
deps-start
deps-update-boost166
deps-update-cppunit-1.14.0
deps-update-libtiff_conf
deps-update-log4cpp-1.1.3
deps-update-matplotlib
deps-update-msgpack-0.5.6
deps-update-msgpack-python
deps-update-openmqc_queue_length
deps-upgrade-h5py-2.7.1
deps-upgrade-traits-4.6.0
pre-consolidated-0.2
pre-consolidated-for-itdm-0.1
testTag-1.4

git status:

On branch versioning-with-setuptools-scm
Your branch is up-to-date with 'origin/versioning-with-setuptools-scm'.
nothing to commit, working directory clean

git describe:

2.2.4rc4-10-g4c9905c

hum, there are some weird tags in the project.

RonnyPfannschmidt commented 6 years ago

this all looks correct so far - whats the putput of SETUPTOOLS_SCM_DEBUG=1 setup.py --version

marcelotrevisani commented 6 years ago

I don't know if I ran that correctly, if I did something wrong, please let me know

SETUPTOOLS_SCM_DEBUG=1 python setup.py --version
looking for ep setuptools_scm.parse_scm_fallback .
root '/home/trevisan/karabo/Framework/src/pythonGui'
looking for ep setuptools_scm.parse_scm /home/trevisan/karabo/Framework/src/pythonGui
looking for ep setuptools_scm.parse_scm_fallback /home/trevisan/karabo/Framework/src/pythonGui
Traceback (most recent call last):
  File "setup.py", line 25, in <module>
    'karabogui.project.dialog': ["*.ui"],
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/__init__.py", line 131, in setup
    return distutils.core.setup(**attrs)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/dist.py", line 370, in __init__
    k: v for k, v in attrs.items()
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools/dist.py", line 529, in finalize_options
    ep.load()(self, ep.name, value)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools_scm/integration.py", line 22, in version_keyword
    dist.metadata.version = get_version(**value)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/site-packages/setuptools_scm/__init__.py", line 119, in get_version
    parsed_version = _do_parse(root, parse)
  File "/home/trevisan/miniconda3/envs/devenv/lib/python3.6/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 '/home/trevisan/karabo/Framework/src/pythonGui'.

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
marcelotrevisani commented 6 years ago

My setup.py is:

from setuptools import setup, find_packages

setup(
    name = 'KaraboGUI',
    author = 'European XFEL Gmbh',
    author_email = 'karabo@xfel.eu',
    use_scm_version={'write_to': 'karabogui/_version.py'},
    setup_requires=['setuptools_scm'],
    description = 'This is the Karabo GUI',
    url = 'http://karabo.eu',
    packages = find_packages(),
    include_package_data = True,
    entry_points = {'console_scripts':
             [
                'karabo-gui=karabogui.programs.gui_runner:main',
                'panel-runner=karabogui.programs.panel_runner:main',
             ]},
    package_data = {
        'karabogui.binding.tests': ["data/*.config", "data/*.schema"],
        'karabogui.configurator.dialog': ["*.ui"],
        'karabogui.controllers': ["*.ui"],
        'karabogui.controllers.display': ["*.svg", "*.ui"],
        'karabogui.dialogs': ["*.ui"],
        'karabogui.icons': ["*.*", "statefulicons/iconset/*.svg"],
        'karabogui.project.dialog': ["*.ui"],
        }
)
RonnyPfannschmidt commented 6 years ago

is the .git dir at the same level as the setup.py or somewhere else?

marcelotrevisani commented 6 years ago

the .git is in two previous folders

RonnyPfannschmidt commented 6 years ago

then you need to feed it the relative_to and the root arguments as well

should be use_scm_version={'root':'../..', ...} at least

marcelotrevisani commented 6 years ago

Oh thanks, that solved my problem. Sorry for this waste of your time :)

RonnyPfannschmidt commented 6 years ago

@marcelotrevisani it wasn't a waste of time, i just learned we have a bad missleading error there and can make things better for users, see the followup issue i created

unless you have further questions please close this one as sorted

marcelotrevisani commented 6 years ago

Sure, I'm going to close this

Thanks for the help! :)

jeammimi commented 4 years ago

I had the same error, but in my case, git was not installed. Best

mbenhalima commented 9 months ago

I had the same error, but in my case, git was not installed. Best

Confirmed this worked after installing git

RUN apt-get update && apt-get install git --assume-yes