ta-lib-python
ta-lib-python copied to clipboard
pip install is failing on Mac
The install seems to be failing now with below error:
talib/_ta_lib.c:10371:41: error: no member named 'subarray' in 'struct _PyArray_Descr' 10371 | __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape)); | ~~~~~~~~~ ^ talib/_ta_lib.c:1657:37: note: expanded from macro '__Pyx_INCREF' 1657 | #define __Pyx_INCREF(r) Py_INCREF(r) | ^ /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/include/python3.12/object.h:661:50: note: expanded from macro 'Py_INCREF' 661 | # define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op)) | ^~ /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/include/python3.12/object.h:194:49: note: expanded from macro '_PyObject_CAST' 194 | #define _PyObject_CAST(op) _Py_CAST(PyObject*, (op)) | ^~ /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:24:38: note: expanded from macro '_Py_CAST' 24 | #define _Py_CAST(type, expr) ((type)(expr)) | ^~~~ talib/_ta_lib.c:10372:38: error: no member named 'subarray' in 'struct _PyArray_Descr' 10372 | __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); | ~~~~~~~~~ ^ 1 warning and 2 errors generated. error: command '/usr/bin/clang' 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 ta-lib Failed to build ta-lib ERROR: Failed to build installable wheels for some pyproject.toml based projects (ta-lib)
you may try to install it from source. download this package to local and then use python setup.py install instead of pip install talib.
Does the just-released 0.6.3 work for you?
I accidentally build 0.6.2 against numpy-1
Does the just-released 0.6.3 work for you?
I accidentally build 0.6.2 against numpy-1
Yes, 0.6.3 did work for me during installation phase. I received en error when trying import talib in python. I reported it in last issue and managed to resolve it but not sure the cause.
also can try pip install ta-lib==0.6.1
0.6.2 and 0.6.3 not working on my mac, but 0.6.1 works fine.
@kit-wwk 0.6.2 was incorrectly built against numpy1, but I fixed it in 0.6.3.
What version of ta-lib do you have installed ? I have brew install ta-lib which is currently 0.6.4.
➜ ~ cd tatest
➜ tatest uv init
Initialized project `tatest`
➜ tatest git:(main) ✗ uv add ta-lib
Using CPython 3.10.16
Creating virtual environment at: .venv
Resolved 4 packages in 765ms
Built ta-lib==0.6.3
Prepared 3 packages in 13.21s
Installed 3 packages in 10ms
+ numpy==2.2.2
+ setuptools==75.8.0
+ ta-lib==0.6.3
➜ tatest git:(main) ✗ uv run python
Python 3.10.16 (main, Dec 19 2024, 14:22:46) [Clang 18.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import talib
>>> import numpy
>>> numpy.__version__
'2.2.2'
>>> talib.__version__
'0.6.3'
>>> c = numpy.random.randn(100)
>>> c[0:5]
array([-0.26470609, 0.36832262, -0.4622708 , -0.1742876 , 0.83104257])
>>> talib.MOM(c)
array([ nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan,
-0.13723411, -1.72661596, -1.81322873, -1.38925071, -1.06222958,
-1.25448246, -2.80747424, -1.63689867, 1.1887257 , 1.89365551,
0.49244929, 1.20951644, 1.77228033, 1.23735248, 0.42719226,
0.84736866, -0.78787156, 1.94179704, -0.69021664, -0.8509612 ,
-1.05043444, 0.97642087, 0.08396399, 0.16441899, 0.83110506,
0.55034711, -0.58169982, 0.28327854, -0.43008133, -0.76289063,
1.53263866, -0.05666452, -1.27337407, 1.81161663, -1.57351613,
-0.23167121, 2.14993833, 0.4328235 , -0.05655823, 1.61301246,
-1.06792983, -1.38631695, 0.99440162, -3.42954549, 2.44345798,
0.50225174, -0.42121709, 0.63866448, 1.19473394, -3.56964201,
-0.03148869, 0.11965942, 0.62212957, 2.1953171 , -1.60062974,
-1.24961499, -1.99203504, -0.93355812, -0.48005788, 4.43890944,
-1.00843646, 1.86179848, -0.84463598, -0.48257893, -0.0677114 ,
1.58797608, 0.91259732, 0.57065301, -1.82029638, 0.22189522,
2.86770445, -1.75132063, 1.64432293, 0.51986086, -2.70137346,
-0.69135722, -1.09434086, -1.86303495, 1.22566961, 0.43566106,
-1.70047269, 0.7828424 , -1.29377698, 0.53758105, 3.00839275,
1.26816535, 2.5472162 , 1.4174191 , -0.53586721, -3.65388078])
@mrjbq7 Sorry, my fault. 0.6.1 and 0.6.3 are fine. My installed ta-lib is 0.6.4 thank you
So sorry for the trouble.
When I cut the 0.6.2 release, i accidentally used a venv that had numpy1. Oops. I’ll be more diligent in the future.
The error message looks similar to https://github.com/TA-Lib/ta-lib-python/issues/655
See also https://github.com/cython/cython/issues/6249 for more context.