ukhsa-collaboration / pygom

ODE modelling in Python
GNU General Public License v2.0
27 stars 20 forks source link

Cannot install via ```python setup.py install``` if using setuptools-scm for getting version. #56

Closed m-d-grunnill closed 1 month ago

m-d-grunnill commented 2 years ago

I have tried to install making sure all the required package are in place. I get the following error when python setup.py install in conda:

Traceback (most recent call last):
  File "setup.py", line 80, in <module>
    setup(
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\distutils\core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools\dist.py", line 453, in __init__
    _Distribution.__init__(
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\distutils\dist.py", line 292, in __init__
    self.finalize_options()
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools\dist.py", line 831, in finalize_options
    ep(self)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools\dist.py", line 852, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\integration.py", line 24, in version_keyword
    dist.metadata.version = _get_version(config)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\__init__.py", line 173, in _get_version
    parsed_version = _do_parse(config)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\__init__.py", line 127, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\__init__.py", line 65, in _version_from_entrypoints
    version = _call_entrypoint_fn(root, config, ep.load())
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\__init__.py", line 46, in _call_entrypoint_fn
    return fn(root, config=config)
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\git.py", line 115, in parse
    require_command("git")
  File "C:\Users\mdgru\anaconda3\envs\pygom\lib\site-packages\setuptools_scm\utils.py", line 142, in require_command
    raise OSError("%r was not found" % name)
OSError: 'git' was not found

When I changed the line 82 of the setup.py from use_scm_version=True, to version=0.17,, the installation worked.

twomagpi commented 2 years ago

Interesting, looks like your system doen't have Git avalable on the command line (which rather messes up the ability to determine the version of the package from Git).

Doing conda install git in either the root environment or the environment you are using before attempting install should solve this. If you don't want to install git then this may be harder to solve.

I'll have a think as using SMC was supposed to avoid the need to explicitly change the version number in files as well as in the version control system (DRY). There may be an easy fix for this (including a different way to read the visrson from git) but equally may also be a bit of a nightmare.

m-d-grunnill commented 2 years ago

Would not listing git as a required package solve this, then?

twomagpi commented 1 month ago

Not really as Git is a separate program not a python package. I'm hoping that the updated build / install from wheels largely resolves this.