Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

项目依赖的pyodbc默认版本4.0.*与项目标称的Python版本不兼容 #2894

Open
huangsijun17 opened this issue Jan 14, 2025 · 0 comments

Comments

@huangsijun17
Copy link

huangsijun17 commented Jan 14, 2025

重现步骤

  1. master分支的requirements.txt写有:
pyodbc==4.*
  1. master分支的README.md写有支持的Python版本包含3.12和3.13。

version

  1. Pyodbc for latest Python version(irrespective of version) mkleehammer/pyodbc#1113 有提到pyodbc 4.X的最高支持Python版本为3.11

预期外的结果

初始化本项目时,pip安装模块失败。

日志文本

Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyodbc (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      WARNING: '' not a valid package name; please use only .-separated package names in setup.py
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-312
      copying src/pyodbc.pyi -> build/lib.linux-x86_64-cpython-312
      running build_ext
      building 'pyodbc' extension
      creating build/temp.linux-x86_64-cpython-312/src
      x86_64-linux-gnu-g++ -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DPYODBC_VERSION=4.0.39 -I/opt/archery/venv4archery/include -I/usr/include/python3.12 -c src/buffer.cpp -o build/temp.linux-x86_64-cpython-312/src/buffer.o -Wno-write-strings
      In file included from src/pyodbc.h:172,
                       from src/buffer.cpp:12:
      src/pyodbccompat.h: In function ‘PyObject* Text_New(Py_ssize_t)’:
      src/pyodbccompat.h:75:12: error: ‘PyUnicode_FromUnicode’ was not declared in this scope; did you mean ‘PyUnicode_FromString’?
         75 |     return PyUnicode_FromUnicode(0, length);
            |            ^~~~~~~~~~~~~~~~~~~~~
            |            PyUnicode_FromString
      src/pyodbccompat.h: In function ‘Py_UNICODE* Text_Buffer(PyObject*)’:
      src/pyodbccompat.h:86:12: error: ‘PyUnicode_AS_UNICODE’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
         86 |     return PyUnicode_AS_UNICODE(o);
            |            ^~~~~~~~~~~~~~~~~~~~
            |            PyUnicode_AsUCS4
      src/pyodbccompat.h: In function ‘Py_ssize_t Text_Size(PyObject*)’:
      src/pyodbccompat.h:126:40: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
        126 |     return (o && PyUnicode_Check(o)) ? PyUnicode_GET_SIZE(o) : 0;
            |                                        ^~~~~~~~~~~~~~~~~~
            |                                        PyDict_GET_SIZE
      src/pyodbccompat.h: In function ‘Py_ssize_t TextCopyToUnicode(Py_UNICODE*, PyObject*)’:
      src/pyodbccompat.h:146:26: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
        146 |         Py_ssize_t cch = PyUnicode_GET_SIZE(o);
            |                          ^~~~~~~~~~~~~~~~~~
            |                          PyDict_GET_SIZE
      src/pyodbccompat.h:147:24: error: ‘PyUnicode_AS_UNICODE’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
        147 |         memcpy(buffer, PyUnicode_AS_UNICODE(o), cch * sizeof(Py_UNICODE));
            |                        ^~~~~~~~~~~~~~~~~~~~
            |                        PyUnicode_AsUCS4
      error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyodbc
Failed to build pyodbc
ERROR: Could not build wheels for pyodbc, which is required to install pyproject.toml-based projects

版本

1.11.3

部署方式

手工部署

是否还有其他可以辅助定位问题的信息?比如数据库版本等

这是因为Readme里用了别的项目的python兼容图标?

  1. 不注释掉pyodbc所在行,requirements.txt安装不下去。
  2. pyodbc可以升到5.x吗?(我没MSSQL需求,但现在是整体初始化失败。
  3. Ubuntu24原生Python3.12,早知道,给装个低版本Python了。
@huangsijun17 huangsijun17 changed the title 依赖的pyodbc默认版本4.0.*与标称的Python版本不兼容 项目依赖的pyodbc默认版本4.0.*与项目标称的Python版本不兼容 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant