setuptools_scm: Version 4.0 breaks on Windows + 2.7

The latest version seems to have lost the use of the samefile backport on Windows + 2.7, causing this error now in CI:

  Downloading setuptools_scm-4.0.0.tar.gz (46 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  ERROR: Command errored out with exit status 1:
   command: 'C:\hostedtoolcache\windows\Python\2.7.18\x86\python.exe' 'C:\hostedtoolcache\windows\Python\2.7.18\x86\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'c:\users\vssadm~1\appdata\local\temp\tmpacqthi'
       cwd: c:\users\vssadm~1\appdata\local\temp\pip-install-yxxmaf\setuptools-scm
  Complete output (22 lines):
  c:\users\vssadm~1\appdata\local\temp\pip-install-yxxmaf\setuptools-scm\src
  <pkg_resources.WorkingSet object at 0x02F22D30>
  Traceback (most recent call last):
    File "C:\hostedtoolcache\windows\Python\2.7.18\x86\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "C:\hostedtoolcache\windows\Python\2.7.18\x86\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\hostedtoolcache\windows\Python\2.7.18\x86\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "c:\users\vssadm~1\appdata\local\temp\pip-build-env-7itkho\overlay\Lib\site-packages\setuptools\build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "c:\users\vssadm~1\appdata\local\temp\pip-build-env-7itkho\overlay\Lib\site-packages\setuptools\build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "c:\users\vssadm~1\appdata\local\temp\pip-build-env-7itkho\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 53, in <module>
      setuptools.setup(**scm_config())
    File "setup.py", line 31, in scm_config
      from setuptools_scm.git import parse as parse_git
    File "c:\users\vssadm~1\appdata\local\temp\pip-install-yxxmaf\setuptools-scm\src\setuptools_scm\git.py", line 9, in <module>
      from os.path import samefile
  ImportError: cannot import name samefile
  ----------------------------------------
  Getting requirements to build wheel: finished with status 'error'

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

4.1.0 is out, and fixed this issue for me. Thanks!

A platform specific xfail

It seems that wheel availability has nothing to do in this case

Yes, it does. In the past, it had a backport of os.path.samefile. Now that has been moved to a dependency. In the changelog for 4.0:

drop the internal copy of samefile and use a dependency on jaraco.windows on legacy systems

The problem is, since there’s no wheel, Python 2 has to build setuptools_scm. And setuptools_scm uses setupstools_scm to build itself, and it doesn’t have a PEP 517 build process, so there’s no way to enforce jaraco.windows be preinstalled while it runs setup.py, so it fails. Adding a 2.7 compatible wheel would fix it; since then there’s no build and you would not use it until it is installed, along with jaraco.windows. Or PEP 517 allows you to specify a setup dependency for making the wheel, so that would also fix it. (But that would require a patch release, while adding a py2 wheel could be done to the same release)

I think the issue may come from the current version of setuptools not supporting Python 2, so it makes Python 3 only wheels by default instead of universal wheels (guessing there).

Edit: I think adding --universal to the setup.py execution would fix it (could still be 4.0.0, since it could be run locally with no code changes), or (for the future 4.0.1) the universal configuration option could be added.

It seems that wheel availability has nothing to do in this case - it fails because os.path.samefile is only available on Unix in Python 2.7 (https://docs.python.org/2/library/os.path.html#os.path.samefile). Looking at the classifiers Python 2.7 is still there - https://github.com/pypa/setuptools_scm/blob/master/setup.cfg#L18. @RonnyPfannschmidt do you plan to keep the package Python 2.7 compatibility or you drop it with 4.0.0?