Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
This repository was archived by the owner on May 15, 2026. It is now read-only.

3.9及以上版本的python通过pip不能安装pyudf #1

Description

@Bob-cn1

描述

在python3.12、3.10、3.9.7中试图通过pip安装udf时报错

报错

root@c86471623cfc:~/Python-3.9.6# ./python -m pip install ./taospyudf-0.0.11 -i https://mirrors.aliyun.com/pypi/simple/
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Processing ./taospyudf-0.0.11
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: taospyudf
  Building wheel for taospyudf (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for taospyudf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [71 lines of output]
      *** scikit-build-core 0.9.3 using CMake 3.29.2 (wheel)
      *** Configuring CMake...
      2024-05-10 09:45:05,811 - scikit_build_core - WARNING - Can't find a Python library, got libdir=/usr/local/lib, ldlibrary=libpython3.9.a, multiarch=aarch64-linux-gnu, masd=None
      loading initial cache file /tmp/tmpcn2w9z14/build/CMakeInit.txt
      -- The CXX compiler identification is GNU 11.4.0
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      CMake Warning (dev) at /tmp/pip-build-env-iu94348c/overlay/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/FindPythonLibsNew.cmake:101 (message):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning, or
        preferably upgrade to using FindPython, either by calling it explicitly
        before pybind11, or by setting PYBIND11_FINDPYTHON ON before pybind11.
      Call Stack (most recent call first):
        /tmp/pip-build-env-iu94348c/overlay/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Tools.cmake:50 (find_package)
        /tmp/pip-build-env-iu94348c/overlay/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Common.cmake:192 (include)
        /tmp/pip-build-env-iu94348c/overlay/lib/python3.9/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake:250 (include)
        CMakeLists.txt:14 (find_package)
      This warning is for project developers.  Use -Wno-dev to suppress it.
      
      -- Found PythonInterp: /root/Python-3.9.6/python (found suitable version "3.9.6", minimum required is "3.6")
      -- Found PythonLibs: python3.9
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Found pybind11: /tmp/pip-build-env-iu94348c/overlay/lib/python3.9/site-packages/pybind11/include (found version "2.12.0")
      -- Configuring done (1.8s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/tmpcn2w9z14/build
      *** Building project with Ninja...
      [1/2] Building CXX object CMakeFiles/taospyudf.dir/src/taospyudf.cpp.o
      [2/2] Linking CXX shared library libtaospyudf.so
      FAILED: libtaospyudf.so
      : && /usr/bin/c++ -fPIC -fpic -O3 -DNDEBUG   -shared -Wl,-soname,libtaospyudf.so -o libtaospyudf.so CMakeFiles/taospyudf.dir/src/taospyudf.cpp.o  -lpython3.9 && :
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(abstract.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_add_one_to_index_C' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(abstract.o): in function `PyBuffer_FromContiguous':
      /root/Python-3.9.6/Objects/abstract.c:593:(.text+0x1934): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(abstract.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_add_one_to_index_F' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Objects/abstract.c:593:(.text+0x1938): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): in function `_PyObject_GetMethod':
      /root/Python-3.9.6/Objects/object.c:1096:(.text+0x1f5c): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): in function `_PyObject_LookupAttr':
      /root/Python-3.9.6/Objects/object.c:916:(.text+0x24b8): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Objects/object.c:916:(.text+0x289c): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Objects/object.c:916:(.text+0x29d0): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Objects/object.c:916:(.text+0x2af4): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(object.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyObject_GenericGetAttr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Objects/object.c:916:(.text+0x2c28): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(typeobject.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `PyType_GenericAlloc' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(typeobject.o): in function `type_new':
      /root/Python-3.9.6/Objects/typeobject.c:2812:(.text+0x136b0): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(hashtable.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_hashtable_compare_direct' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(hashtable.o): in function `_Py_hashtable_new_full':
      /root/Python-3.9.6/Python/hashtable.c:354:(.text+0x514): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(hashtable.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_hashtable_hash_ptr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Python/hashtable.c:354:(.text+0x51c): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(hashtable.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_hashtable_hash_ptr' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Python/hashtable.c:354:(.text+0x608): dangerous relocation: unsupported relocation
      /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../../lib/libpython3.9.a(hashtable.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Py_hashtable_compare_direct' which may bind externally can not be used when making a shared object; recompile with -fPIC
      /root/Python-3.9.6/Python/hashtable.c:354:(.text+0x61c): dangerous relocation: unsupported relocation
      collect2: error: ld returned 1 exit status
      ninja: build stopped: subcommand failed.
      
      *** CMake build failed
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for taospyudf
Failed to build taospyudf                                                                               
ERROR: Could not build wheels for taospyudf, which is required to install pyproject.toml-based projects

在python3.12、3.10中pip是直接安装的taospyudf,报错同上;此处的python3.9环境中我解决了脱机编译python的在pip安装时的环境问题,之后尝试安装时报错。

在3.9的环境中有尝试按照为cmake添加fpic编译选项的搜索结果通过pip download下载包后编辑CMakeList,但编译选项未生效。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions