NREL / bifacial_radiance

Toolkit for working with RADIANCE for the ray-trace modeling of Bifacial Photovoltaics
https://bifacial-radiance.readthedocs.io
BSD 3-Clause "New" or "Revised" License
91 stars 48 forks source link

setuptools_scm is crashing if git is not present #535

Closed cdeline closed 3 months ago

cdeline commented 3 months ago

Some sort of error when pip install -e . from new v0.4.3 release.
WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section' ERROR: setuptools_scm.run_cmd command git missing image

cdeline commented 3 months ago

Confirming that lack of command line git causes v0.4.3 setup to fail. Of course the best solution is to just download and install git.

C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools\dist.py:788: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools__init.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try pip install --use-pep517. dist.fetch_build_eggs(dist.setup_requires) WARNING: Ignoring invalid distribution -ws-access-cred-manager (c:\users\cdeline\anaconda3\lib\site-packages) WARNING: Ignoring invalid distribution -tatsmodels (c:\users\cdeline\anaconda3\lib\site-packages) WARNING: Ignoring invalid distribution -oloviews (c:\users\cdeline\anaconda3\lib\site-packages) WARNING: Ignoring invalid distribution -ffi (c:\users\cdeline\anaconda3\lib\site-packages) WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section' Traceback (most recent call last): File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_integration\pyproject_reading.py", line 36, in read_pyproject section = defn.get("tool", {})[tool_name] KeyError: 'setuptools_scm' WARNING setuptools_scm.run_cmd command git missing: [WinError 2] The system cannot find the file specified ERROR setuptools_scm._get_version_impl command git not found while parsing the scm, using fallbacks Traceback (most recent call last): File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_get_version_impl.py", line 40, in parse_scm_version return _entrypoints.version_from_entrypoint( File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_entrypoints.py", line 57, in version_from_entrypoint maybe_version: version.ScmVersion | None = fn(root, config=config) File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm\git.py", line 212, in parse _require_command("git") File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_run_cmd.py", line 214, in require_command raise CommandNotFoundError(name) setuptools_scm._run_cmd.CommandNotFoundError: git Traceback (most recent call last): File "", line 1, in File "F:\Documents\Python Scripts\bifacial_radiance\setup.py", line 31, in setup( File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools__init__.py", line 108, in setup return distutils.core.setup(**attrs) File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools_distutils\core.py", line 147, in setup _setup_distribution = dist = klass(attrs) File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools\dist.py", line 488, in init _Distribution.init( File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 283, in init__ self.finalize_options() File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools\dist.py", line 912, in finalize_options ep(self) File "C:\Users\cdeline\Anaconda3\lib\site-packages\setuptools\dist.py", line 932, in _finalize_setup_keywords ep.load()(self, ep.name, value) File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_integration\setuptools.py", line 103, in version_keyword _assign_version(dist, config) File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_integration\setuptools.py", line 58, in _assign_version _version_missing(config) File "f:\documents\python scripts\bifacial_radiance.eggs\setuptools_scm-8.1.0-py3.9.egg\setuptools_scm_get_version_impl.py", line 117, in _version_missing raise LookupError( LookupError: setuptools-scm was unable to detect version for F:\Documents\Python Scripts\bifacial_radiance.

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
cdeline commented 3 months ago

Testing reveals that installation from pip (pip install bifacial_radiance) results in correct installation, but downloading of the .zip file and installing with pip install -e . causes errors, whether you've downloaded with github manager, or directly downloading the zip file.

The solution is to just download and install command line git

cdeline commented 3 months ago

OK, setuptools_scm has a fallback_version parameter in setup.py or pyproject.toml that can be used. trying that. Works!