[issue36539] Distutils VC 6.0 Errors When Using mingw-w64 GCC

Dan Yeaw report at bugs.python.org
Fri Apr 5 17:13:22 EDT 2019


New submission from Dan Yeaw <dan at yeaw.me>:

I am using the mingw-w64-x86_64-python3 in MSYS2 on Windows to package a PyGObject app. When I try to pip install the app, I am getting errors about the VC 6.0 isn't supported.

It looks like setuptools is trying to patch distutils msvc. The msvc9compiler module in distutils uses a get_build_version function to get the version of MSVC on the system. This version of Python 3 is compiled with GCC 8.3.0 so the function doesn't find the "MSC v." prefix and returns version 6.

Here is the full error:

$ pip install -e .
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  Complete output from command C:/tools/msys64/mingw64/bin/python3.exe C:/tools/msys64/mingw64/lib/python3.7/site-packages\pip install --ignore-installed --no-user --prefix C:/Users/dyeaw/AppData/Local/Temp/pip-build-env-bfwge_92/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- gaphas>=1.0.0,<2.0.0 PyGObject>=3.30,<4.0 pycairo>=1.18,<2.0 zope.component>=4.5,<5.0:
  Collecting gaphas<2.0.0,>=1.0.0
    Using cached https://files.pythonhosted.org/packages/68/1d/4c8501535889538fe2144b5b8836fa2b3296e06d4a3d9f7e4e7e8cc1e90f/gaphas-1.0.0-py2.py3-none-any.whl
  Collecting PyGObject<4.0,>=3.30
    Using cached https://files.pythonhosted.org/packages/0b/fd/56ac6898afc5c7f5718026103bd8f0b44714b6f79ac20d7eb8990c9a7eab/PyGObject-3.32.0.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    Complete output from command C:/tools/msys64/mingw64/bin/python3.exe C:/tools/msys64/mingw64/lib/python3.7/site-packages/pep517/_in_process.py get_requires_for_build_wheel C:/Users/dyeaw/AppData/Local/Temp/tmp8lre6w7i:
    Traceback (most recent call last):
      File "C:/tools/msys64/mingw64/lib/python3.7/site-packages/pep517/_in_process.py", line 207, in <module>
        main()
      File "C:/tools/msys64/mingw64/lib/python3.7/site-packages/pep517/_in_process.py", line 197, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:/tools/msys64/mingw64/lib/python3.7/site-packages/pep517/_in_process.py", line 48, in get_requires_for_build_wheel
        backend = _build_backend()
      File "C:/tools/msys64/mingw64/lib/python3.7/site-packages/pep517/_in_process.py", line 34, in _build_backend
        obj = import_module(mod_path)
      File "C:/tools/msys64/mingw64/lib/python3.7\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
      File "<frozen importlib._bootstrap>", line 983, in _find_and_load
      File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
      File "<frozen importlib._bootstrap>", line 983, in _find_and_load
      File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "C:/Users/dyeaw/AppData/Local/Temp/pip-build-env-5pamh2nb/overlay/lib/python3.7/site-packages\setuptools\__init__.py", line 228, in <module>
        monkey.patch_all()
      File "C:/Users/dyeaw/AppData/Local/Temp/pip-build-env-5pamh2nb/overlay/lib/python3.7/site-packages\setuptools\monkey.py", line 101, in patch_all
        patch_for_msvc_specialized_compiler()
      File "C:/Users/dyeaw/AppData/Local/Temp/pip-build-env-5pamh2nb/overlay/lib/python3.7/site-packages\setuptools\monkey.py", line 164, in patch_for_msvc_specialized_compiler
        patch_func(*msvc9('find_vcvarsall'))
      File "C:/Users/dyeaw/AppData/Local/Temp/pip-build-env-5pamh2nb/overlay/lib/python3.7/site-packages\setuptools\monkey.py", line 151, in patch_params
        mod = import_module(mod_name)
      File "C:/tools/msys64/mingw64/lib/python3.7\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
      File "<frozen importlib._bootstrap>", line 983, in _find_and_load
      File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "C:/tools/msys64/mingw64/lib/python3.7\distutils\msvc9compiler.py", line 296, in <module>
        raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
    distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module

Others are getting this error as well: https://stackoverflow.com/questions/52166914/msys2-mingw64-pip-vc-6-0-is-not-supported-by-this-module

One way to fix may be to not raise the error if it occurs:
VERSION = get_build_version()
if VERSION < 8.0:
-    raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
+    pass

If you think this should be fixed in Setuptools to not try to patch distutils in this instance, or downstream in mingw-w64 packages, please point me in the right direction. I am also glad to help submit a PR if I can have some guidance on the best approach.

----------
components: Distutils
messages: 339520
nosy: danyeaw, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Distutils VC 6.0 Errors When Using mingw-w64 GCC
type: compile error
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36539>
_______________________________________


More information about the Python-bugs-list mailing list