TA-Lib/ta-lib-python

Building wheel for ta-lib (pyproject.toml) did not run successfully. (Ta-lib C dependency is already installed)

sainiankit opened this issue · 6 comments

This docker file used to build fine before March 2024, Has suddenly started failing with the following error:

Dockerfile:

FROM python:3.9-slim

WORKDIR /app

COPY . .

RUN apt-get update \
    && apt-get install gcc -y \
    && apt-get install make -y \
    && apt-get install git -y \
    && apt-get install curl -y \
    && apt-get install python3-dev -y \
    && apt-get clean

RUN curl -SLO http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
    tar -xvzf ta-lib-0.4.0-src.tar.gz && \
    cd ./ta-lib/ && \
    ./configure --prefix=/usr && \
    make && \
    make install

RUN rm -R ta-lib-0.4.0-src.tar.gz ta-lib

RUN pip install pipenv

ENV LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}
ENV C_INCLUDE_PATH=/usr/include:${C_INCLUDE_PATH}

RUN pipenv install --system --dev --ignore-pipfile

Error Encountered:

24.51 [pipenv.exceptions.InstallError]:   Building wheel for ta-lib (pyproject.toml): started
24.51 [pipenv.exceptions.InstallError]:   Building wheel for ta-lib (pyproject.toml): finished with status 'error'
24.51 [pipenv.exceptions.InstallError]: Successfully built kappa placebo
24.51 [pipenv.exceptions.InstallError]: Failed to build ta-lib
24.51 [pipenv.exceptions.InstallError]: error: subprocess-exited-with-error
24.51 [pipenv.exceptions.InstallError]:   
24.51 [pipenv.exceptions.InstallError]:   × Building wheel for ta-lib (pyproject.toml) did not run successfully.
24.51 [pipenv.exceptions.InstallError]:   │ exit code: 1
24.51 [pipenv.exceptions.InstallError]:   ╰─> [90 lines of output]
24.51 [pipenv.exceptions.InstallError]:       running bdist_wheel
24.51 [pipenv.exceptions.InstallError]:       running build
24.51 [pipenv.exceptions.InstallError]:       running build_py
24.51 [pipenv.exceptions.InstallError]:       creating build
24.51 [pipenv.exceptions.InstallError]:       creating build/lib.linux-x86_64-cpython-39
24.51 [pipenv.exceptions.InstallError]:       creating build/lib.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       copying talib/stream.py -> build/lib.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       copying talib/abstract.py -> build/lib.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       copying talib/__init__.py -> build/lib.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       warning: build_py: byte-compiling is disabled, skipping.
24.51 [pipenv.exceptions.InstallError]:       
24.51 [pipenv.exceptions.InstallError]:       running build_ext
24.51 [pipenv.exceptions.InstallError]:       building 'talib._ta_lib' extension
24.51 [pipenv.exceptions.InstallError]:       creating build/temp.linux-x86_64-cpython-39
24.51 [pipenv.exceptions.InstallError]:       creating build/temp.linux-x86_64-cpython-39/talib
24.51 [pipenv.exceptions.InstallError]:       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/tmp/pip-build-env-o6lcnnq2/normal/lib/python3.9/site-packages/numpy/_core/include -I/usr/local/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-39/talib/_ta_lib.o
24.51 [pipenv.exceptions.InstallError]:       In file included from /tmp/pip-build-env-o6lcnnq2/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/ndarraytypes.h:1909,
24.51 [pipenv.exceptions.InstallError]:                        from /tmp/pip-build-env-o6lcnnq2/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/ndarrayobject.h:12,
24.51 [pipenv.exceptions.InstallError]:                        from /tmp/pip-build-env-o6lcnnq2/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/arrayobject.h:5,
24.51 [pipenv.exceptions.InstallError]:                        from talib/_ta_lib.c:1092:
24.51 [pipenv.exceptions.InstallError]:       /tmp/pip-build-env-o6lcnnq2/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
24.51 [pipenv.exceptions.InstallError]:          17 | #warning "Using deprecated NumPy API, disable it with " \
24.51 [pipenv.exceptions.InstallError]:             |  ^~~~~~~
24.51 [pipenv.exceptions.InstallError]:       In file included from /usr/local/include/python3.9/pytime.h:6,
24.51 [pipenv.exceptions.InstallError]:                        from /usr/local/include/python3.9/Python.h:81,
24.51 [pipenv.exceptions.InstallError]:                        from talib/_ta_lib.c:16:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_f_5numpy_PyDataType_SHAPE’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:10093:39: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘subarray’
24.51 [pipenv.exceptions.InstallError]:       10093 |     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
24.51 [pipenv.exceptions.InstallError]:             |                                       ^~
24.51 [pipenv.exceptions.InstallError]:       /usr/local/include/python3.9/object.h:112:41: note: in definition of macro ‘_PyObject_CAST’
24.51 [pipenv.exceptions.InstallError]:         112 | #define _PyObject_CAST(op) ((PyObject*)(op))
24.51 [pipenv.exceptions.InstallError]:             |                                         ^~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:1527:27: note: in expansion of macro ‘Py_INCREF’
24.51 [pipenv.exceptions.InstallError]:        1527 |   #define __Pyx_INCREF(r) Py_INCREF(r)
24.51 [pipenv.exceptions.InstallError]:             |                           ^~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:10093:5: note: in expansion of macro ‘__Pyx_INCREF’
24.51 [pipenv.exceptions.InstallError]:       10093 |     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
24.51 [pipenv.exceptions.InstallError]:             |     ^~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:10094:36: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘subarray’
24.51 [pipenv.exceptions.InstallError]:       10094 |     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
24.51 [pipenv.exceptions.InstallError]:             |                                    ^~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_348_ta_getFuncInfo’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:51556:48: warning: passing argument 2 of ‘TA_GetFuncInfo’ from incompatible pointer type [-Wincompatible-pointer-types]
24.51 [pipenv.exceptions.InstallError]:       51556 |   __pyx_v_retCode = TA_GetFuncInfo(__pyx_t_1, (&__pyx_v_info));
24.51 [pipenv.exceptions.InstallError]:             |                                               ~^~~~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:             |                                                |
24.51 [pipenv.exceptions.InstallError]:             |                                                TA_FuncInfo **
24.51 [pipenv.exceptions.InstallError]:       In file included from talib/_ta_lib.c:1084:
24.51 [pipenv.exceptions.InstallError]:       /usr/include/ta-lib/ta_abstract.h:211:48: note: expected ‘const TA_FuncInfo **’ but argument is of type ‘TA_FuncInfo **’
24.51 [pipenv.exceptions.InstallError]:         211 |                            const TA_FuncInfo **funcInfo );
24.51 [pipenv.exceptions.InstallError]:             |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_350_ta_getInputParameterInfo’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:51832:71: warning: passing argument 3 of ‘TA_GetInputParameterInfo’ from incompatible pointer type [-Wincompatible-pointer-types]
24.51 [pipenv.exceptions.InstallError]:       51832 |   __pyx_v_retCode = TA_GetInputParameterInfo(__pyx_t_1, __pyx_v_idx, (&__pyx_v_info));
24.51 [pipenv.exceptions.InstallError]:             |                                                                      ~^~~~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:             |                                                                       |
24.51 [pipenv.exceptions.InstallError]:             |                                                                       TA_InputParameterInfo **
24.51 [pipenv.exceptions.InstallError]:       /usr/include/ta-lib/ta_abstract.h:442:68: note: expected ‘const TA_InputParameterInfo **’ but argument is of type ‘TA_InputParameterInfo **’
24.51 [pipenv.exceptions.InstallError]:         442 |                                      const TA_InputParameterInfo **info );
24.51 [pipenv.exceptions.InstallError]:             |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_352_ta_getOptInputParameterInfo’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:52084:74: warning: passing argument 3 of ‘TA_GetOptInputParameterInfo’ from incompatible pointer type [-Wincompatible-pointer-types]
24.51 [pipenv.exceptions.InstallError]:       52084 |   __pyx_v_retCode = TA_GetOptInputParameterInfo(__pyx_t_1, __pyx_v_idx, (&__pyx_v_info));
24.51 [pipenv.exceptions.InstallError]:             |                                                                         ~^~~~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:             |                                                                          |
24.51 [pipenv.exceptions.InstallError]:             |                                                                          TA_OptInputParameterInfo **
24.51 [pipenv.exceptions.InstallError]:       /usr/include/ta-lib/ta_abstract.h:446:74: note: expected ‘const TA_OptInputParameterInfo **’ but argument is of type ‘TA_OptInputParameterInfo **’
24.51 [pipenv.exceptions.InstallError]:         446 |                                         const TA_OptInputParameterInfo **info );
24.51 [pipenv.exceptions.InstallError]:             |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_354_ta_getOutputParameterInfo’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:52374:72: warning: passing argument 3 of ‘TA_GetOutputParameterInfo’ from incompatible pointer type [-Wincompatible-pointer-types]
24.51 [pipenv.exceptions.InstallError]:       52374 |   __pyx_v_retCode = TA_GetOutputParameterInfo(__pyx_t_1, __pyx_v_idx, (&__pyx_v_info));
24.51 [pipenv.exceptions.InstallError]:             |                                                                       ~^~~~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:             |                                                                        |
24.51 [pipenv.exceptions.InstallError]:             |                                                                        TA_OutputParameterInfo **
24.51 [pipenv.exceptions.InstallError]:       /usr/include/ta-lib/ta_abstract.h:450:70: note: expected ‘const TA_OutputParameterInfo **’ but argument is of type ‘TA_OutputParameterInfo **’
24.51 [pipenv.exceptions.InstallError]:         450 |                                       const TA_OutputParameterInfo **info );
24.51 [pipenv.exceptions.InstallError]:             |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c: In function ‘__pyx_f_5talib_7_ta_lib___ta_getFuncHandle’:
24.51 [pipenv.exceptions.InstallError]:       talib/_ta_lib.c:53011:126: warning: passing argument 2 of ‘TA_GetFuncHandle’ from incompatible pointer type [-Wincompatible-pointer-types]
24.51 [pipenv.exceptions.InstallError]:       53011 |   __pyx_t_1 = __pyx_f_5talib_7_ta_lib__ta_check_success(__pyx_n_s_TA_GetFuncHandle, TA_GetFuncHandle(__pyx_v_function_name, (&__pyx_v_handle)), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 772, __pyx_L1_error)
24.51 [pipenv.exceptions.InstallError]:             |                                                                                                                             ~^~~~~~~~~~~~~~~~
24.51 [pipenv.exceptions.InstallError]:             |                                                                                                                              |
24.51 [pipenv.exceptions.InstallError]:             |                                                                                                                              TA_FuncHandle ** {aka unsigned int **}
24.51 [pipenv.exceptions.InstallError]:       /usr/include/ta-lib/ta_abstract.h:155:52: note: expected ‘const TA_FuncHandle **’ {aka ‘const unsigned int **’} but argument is of type ‘TA_FuncHandle **’ {aka ‘unsigned int **’}
24.51 [pipenv.exceptions.InstallError]:         155 |                              const TA_FuncHandle **handle );
24.51 [pipenv.exceptions.InstallError]:             |                              ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
24.51 [pipenv.exceptions.InstallError]:       error: command '/usr/bin/gcc' failed with exit code 1
24.51 [pipenv.exceptions.InstallError]:       [end of output]
24.51 [pipenv.exceptions.InstallError]:   
24.51 [pipenv.exceptions.InstallError]:   note: This error originates from a subprocess, and is likely not a problem with pip.
24.51 [pipenv.exceptions.InstallError]:   ERROR: Failed building wheel for ta-lib
24.51 [pipenv.exceptions.InstallError]: ERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects
24.51 ERROR: Couldn't install package: {}
24.51  Package installation failed...
24.52 /usr/local/lib/python3.9/subprocess.py:1052: ResourceWarning: subprocess 10 is still running
24.52   _warn("subprocess %s is still running" % self.pid,
24.52 ResourceWarning: Enable tracemalloc to get the object allocation traceback
24.52 sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=8 encoding='utf-8'>
24.52 ResourceWarning: Enable tracemalloc to get the object allocation traceback
24.52 sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=11 encoding='utf-8'>
24.52 ResourceWarning: Enable tracemalloc to get the object allocation traceback
------
dockerfile:39
--------------------
  37 |     ENV C_INCLUDE_PATH=/usr/include:${C_INCLUDE_PATH}
  38 |     
  39 | >>> RUN pipenv install --system --dev --ignore-pipfile
  40 |     
  41 |     CMD [ "cd", "/app" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c pipenv install --system --dev --ignore-pipfile" did not complete successfully: exit code: 1

Queries:

  • What change could have broken the working dockerfile.
  • What can be done to fix this ?

Pipfile Used:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
black = "==21.7b0"
pytest = "*"

[packages]
ta-lib = "==0.4.28"
install = "*"
python-dotenv = "*"
markupsafe = "==2.1.3"
pandas = "*"
numpy = "*"

[requires]
python_version = "3.9.7"

[pipenv]
allow_prereleases = true

This doesn't seem to be docker related, since the same issue happens when trying to install normally on Fedora 40, TA-lib installed and built from source (version 0.4.0) and with python3.12. Did you end up figuring out any solutions to this?

It seems maybe PEP517 related? I am able to reproduce when trying to use poetry to install version 0.4.28. Switching to using a git dependency works, as does pulling the latest source and installing that folder in editable mode. Could be it's already fixed in main.

Hi @briancappello, I released 0.4.29 from git master, would you mind checking if that works as a pypi dependency?

Thanks!

Awesome, thanks @mrjbq7 ! It works for me now with poetry on 3.10 and 3.12, both with 64bit x86 and M2 Linux.

Awesome!