← All tasks
pythonmhammond/pywin32 #1813Not a task: not reproduced

[adodbapi] incompatibility with setuptools >= 58.0.0

envgap__mhammond__pywin32-1813

01 / FAILURE SIGNATURE

As reported upstream

ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py' (D:\a\.venv\lib\site-packages\setuptools\_distutils\command\build_py.py)
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
ed96e891efa1e6012c6d18747ed5e6931b9ce793
Manifest
adodbapi/setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

mhammond/pywin32 #1813 · read the original issue
* Expected behavior and actual behavior.



Expected behavior: Running setup.py should work

Actual behavior: Setup.py errors out when setuptools>=58.0



```

Command D:\a\.venv\Scripts\pip.exe install --no-deps C:\Users\runneradmin\AppData\Local\pypoetry\Cache\artifacts\cc\3f\a9\1e3dbf940725ac6769f95e76bd4c91d84bf567ec3f3f969b87e52e6bfa\adodbapi-2.6.2.0.zip errored with the following return code 1, and output: 

  Processing c:\users\runneradmin\appdata\local\pypoetry\cache\artifacts\cc\3f\a9\1e3dbf940725ac6769f95e76bd4c91d84bf567ec3f3f969b87e52e6bfa\adodbapi-2.6.2.0.zip



    Preparing metadata (setup.py): started



    Preparing metadata (setup.py): finished with status 'error'

ERROR: Command errored out with exit status 1:



     command: 'D:\a\.venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\pip-req-build-6rihmynu\\setup.py'"'"'; __file__='"'"'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\pip-req-build-6rihmynu\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\RUNNER~1\AppData\Local\Temp\pip-pip-egg-info-3jfmf1i8'



         cwd: C:\Users\RUNNER~1\AppData\Local\Temp\pip-req-build-6rihmynu\



    Complete output (15 lines):



    Traceback (most recent call last):



      File "C:\Users\RUNNER~1\AppData\Local\Temp\pip-req-build-6rihmynu\setup.py", line 51, in setup_package



        from distutils.command.build_py import build_py_2to3 as build_py



    ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py' (D:\a\.venv\lib\site-packages\setuptools\_distutils\command\build_py.py)



    



    During handling of the above exception, another exception occurred:



    



    Traceback (most recent call last):



      File "<string>", line 1, in <module>



      File "C:\Users\RUNNER~1\AppData\Local\Temp\pip-req-build-6rihmynu\setup.py", line 89, in <module>



        setup_package()



      File "C:\Users\RUNNER~1\AppData\Local\Temp\pip-req-build-6rihmynu\setup.py", line 59, in setup_package



        raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")



    ImportError: build_py_2to3 not found in distutils - it is required for Python 3.x



    adodbapi version="2.6.2.0"



```



* Steps to reproduce the problem.



```

pip install pip --upgrade

pip install setuptools --upgrade

pip install adodbapi

```



Example repo with repro: https://github.com/anderssonjohan/test-install-adodbapi/blob/main/.github/workflows/push.yml



* Version of Python and pywin32



- python 3.7.9

- adodbapi 2.6.2.0



* Solution



This is caused by the breaking changes noted in [setuptools 58 release notes](https://github.com/pypa/setuptools/blob/47b724639703d0c512f275a316dbb99e6c226e38/CHANGES.rst) which boils down to lib2to3 being removed from Python 3.10.



Suggested fix? Apply lib2to3 to the code before build to be able to use newer versions of setuptools / python 3.10 compat (example PR from another db lib: https://github.com/ibmdb/python-ibmdb/pull/661)

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]