setuptools_scm looks for setup.cfg when python -m used for pip install
shimwell opened this issue · comments
Many thanks for making and maintaining setuptools_scm
I'm just raising this issue as I spotted some strange behaviour which I think is a bug
I'm running python -m pip install .
and python -m pip install -e .
on a python package that uses just a pyprojects.toml file.
I don't have a saetup.py or a setup.cfg in the project.
However I get this error which I think comes from setuptools_scm
$ python -m pip install .
Processing /home/j/GEOUNED
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
Traceback (most recent call last):
File "/home/j/miniforge-pypy3/envs/geouned_py311/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/j/miniforge-pypy3/envs/geouned_py311/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/j/miniforge-pypy3/envs/geouned_py311/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 1, in <module>
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 104, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 146, in setup
_setup_distribution = dist = klass(attrs)
^^^^^^^^^^^^
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 307, in __init__
_Distribution.__init__(self, dist_attrs)
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 284, in __init__
self.finalize_options()
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 658, in finalize_options
ep(self)
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 113, in infer_version
dist_name = read_dist_name_from_setup_cfg()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-ysif0m08/overlay/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 24, in read_dist_name_from_setup_cfg
parser.read([input], encoding="utf-8")
File "/home/j/miniforge-pypy3/envs/geouned_py311/lib/python3.11/configparser.py", line 711, in read
with open(filename, encoding=encoding) as fp:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'setup.cfg'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
If I make an empty setup.cfg the package install works fine but I would rather not have the empty file.
I am a bit suspicions that this is just an issue with my local environment as it appears that pip install .
and pip install -e .
work fine without the python -m
at the front. However because I'm in a conda environment I would like to keep the python -m
at the front of the command.
apologies I've tested this in CI and on another computer and am not sure it is just a mess with my local env
I'm most curious why's that happening, there's specific code in place to avoid reading the file when its missing