Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow 2.6.0 and TA-lib 0.4.21 numpy version collision

I'm trying to use both TA-lib version 0.4.21 and Tensorflow 2.6.0 in the same project. Both require different numpy versions: TF ~= 1.19.2 TA-lib >= 1.19.4

Given those dependencies, numpy 1.19.4 or 1.19.5 should work just fine, but I get the following exception:

numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

I tried uninstalling and installing numpy 1.19.4 and 1.19.5 several times, on python 3.8 and 3.9 but the result is the same.

Removing TF and using latest version on numpy resolves the issue - but this isn't a solution for me.

Didn't find anything online about this collision between the two libraries.

Will be glad for help, thanks!

like image 914
Crispy Holiday Avatar asked Nov 14 '22 19:11

Crispy Holiday


1 Answers

Try to install numpy first with:

pip install numpy==1.19.5 # This the TF version. 

Than compile and install TA-lib:

# downloag tar.gz file
./configure
make
make install

pip install TA-lib --no-binary TA-lib

You will rebuild the package with the outdated numpy C API usage.

It worked here in ubuntu 20.04.

like image 196
Daniel Negrini Avatar answered Jan 17 '23 00:01

Daniel Negrini