ta-lib-python
ta-lib-python copied to clipboard
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
Hello,
I'm trying to use TA-lib on my Ubuntu 18.04 instance. I installed the package using
sudo ./configure
sudo make
sudo make install
and then install ta-lib using pip install ta-lib
When I try to import talib, I got the following error:
>>> import talib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/user/virtualenv/lib/python3.7/site-packages/talib/__init__.py", line 52, in <module>
from ._ta_lib import (
File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
The only recommendation I found on internet was to install python 3.8 which isn't a possibility for me right now (to many dependencies on my project). Any idea what's the issue could be ?
Thanks in advance.
Am having this issue as well on my server, but not on local Ubuntu. Have u found a fix?
I suspect it’s an issue with pip being different than the Python you want to use.
Try this:
python3.9 -m pip install ta-lib
(Replace python3.9 with whichever Python you are using )
On Jan 7, 2021, at 7:04 AM, Emmanuel Iturbide [email protected] wrote:
Hello,
I'm trying to use TA-lib on my Ubuntu 18.04 instance. I installed the package using
sudo ./configure sudo make sudo make install and then install ta-lib using pip install ta-lib
When I try to import talib, I got the following error:
import talib Traceback (most recent call last): File "
", line 1, in File "/home/user/user/virtualenv/lib/python3.7/site-packages/talib/init.py", line 52, in from ._ta_lib import ( File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject The only recommendation I found on internet was to install python 3.8 which isn't a possibility for me right now (to many dependencies on my project). Any idea what's the issue could be ? Thanks in advance.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Updated python3 to python3.8 and now the error is not there anymore
Updating numpy==1.20.0 also helped in my case. (have used numpy==1.19.5)
You might wanna reference https://github.com/pypa/pip/issues/9542 regarding this, as the pip build-behaviour that's causing this is being discussed there.
I ran into this as well. Looks like updating to numpy==1.20.0 does indeed resolve it but I'm wondering if it will break again the next time numpy puts out another release.
Is the issue here that ta-lib is being installed against the latest available version of numpy which may be different from the version of numpy installed in the runtime environment?
numpy is ABI forward compatible - so if you got ta-lib installed once, it'll work, as a new version will always be newer.
During build time, pip installs the latest version (see issue above) in the build environment. If your environment then has a older version, it may break (as shown here).
Apparently, this can be fixed by changing the build-dependency to oldest-supported-numpy - as this will exploit the forward compatibility
@mrjbq7 using python3.7 -m pip install ta-lib instead of pip install ta-lib and it worked.
(I'm using a virtualenv, so I'm not sure why this is the solution tbh)
I ran into this as well. Looks like updating to numpy==1.20.0 does indeed resolve it but I'm wondering if it will break again the next time numpy puts out another release.
this sucks since tensorflow-macos 2.5 is tied to 1.19
What’s the issue?
This Python project doesn’t require new numpy, although the C file that is checked in might be generated with new numpy.
Nothing stops using Cython to generate and install it with other numpy versions?
On Sep 19, 2021, at 3:26 PM, Manuel Schneider @.***> wrote:
I ran into this as well. Looks like updating to numpy==1.20.0 does indeed resolve it but I'm wondering if it will break again the next time numpy puts out another release.
this sucks since tensorflow-macos 2.5 is tied to 1.19
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
I’m currently trying to build a Docker container with some libraries, between them are: numpy ;ta-lib.
The problem is that some library requires numpy<=1.19 and when using that version of numpy presents this error:
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
That binary incompatibility was fixed in numpy>=1.20, but I can't use that numpy version because of other dependencies that requires numpy<=1.19
There is any way to build a Docker container with ta-lib and numpy<=1.19?
Should work fine. You might need to regenerate the C files using Cython.
You can run “make cython” to do that
On Nov 13, 2021, at 9:19 AM, Maximo Ripani @.***> wrote:
I’m currently trying to build a Docker container with some libraries, between them are: numpy ;ta-lib.
The problem is that some library requires numpy<1.19 and when using that version of numpy presents this error:
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
Those binary incompatibility where fixed in numpy>=1.20, but I can't use that version of numpy because another dependencies.
Therre is any way to build a Docker container with ta-lib and numpy<=1.19?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
I already tried it. Another error appeared:
[8/8] RUN sudo make cython:
#12 0.689 make: *** No rule to make target 'cython'. Stop.
------
executor failed running [/bin/sh -c sudo make cython]: exit code: 2
Should work fine. You might need to regenerate the C files using Cython. You can run “make cython” to do that … On Nov 13, 2021, at 9:19 AM, Maximo Ripani @.***> wrote: I’m currently trying to build a Docker container with some libraries, between them are: numpy ;ta-lib. The problem is that some library requires numpy<1.19 and when using that version of numpy presents this error: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject Those binary incompatibility where fixed in numpy>=1.20, but I can't use that version of numpy because another dependencies. Therre is any way to build a Docker container with ta-lib and numpy<=1.19? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
I dunno about your Docker integration, but it's there:
$ make cython
cython --directive emit_code_comments=False talib/_ta_lib.pyx
But maybe that's not the way to fix it -- the next release will no longer specify a numpy version, which might make it easier to support various combinations of versions.
Hello! I'm steel dealing with the error
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.8/site-packages/talib/__init__.py", line 93, in <module> from ._ta_lib import ( File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
I'm currently using numpy==1.21.5 and TA-Lib==0.4.24.
To solve the error I should update to numpy==1.22 but other dependencies that I have work only for numpy<=1.21.*.
Is possible to work with TA-Lib and numpy<=1.21?
I don't specify a version of numpy that's required.
Have you tried doing a git checkout and installing from python setup.py install?
That would allow you to regenerate the C bindings for your local numpy version (make cython)
I had the same problem and could solve it by updating the numpy:
pip install --upgrade numpy
I have ta-lib==0.4.24 and numpy==1.22.3
Hello,
I'm trying to use TA-lib on my Ubuntu 18.04 instance. I installed the package using
sudo ./configure sudo make sudo make installand then install ta-lib using pip install ta-lib
When I try to import talib, I got the following error:
>>> import talib Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/user/virtualenv/lib/python3.7/site-packages/talib/__init__.py", line 52, in <module> from ._ta_lib import ( File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObjectThe only recommendation I found on internet was to install python 3.8 which isn't a possibility for me right now (to many dependencies on my project). Any idea what's the issue could be ?
Thanks in advance.
I generate the C files using latest numpy and cython.
Maybe you need to regenerate them for your numpy version.
$ make cython $ python setup.py install
On Mar 29, 2022, at 11:43 AM, Keivan @.***> wrote:
I had the same problem and could solve it by updating the numpy:
pip install --upgrade numpy I have ta-lib==0.4.24 and numpy==1.22.3
Hello,
I'm trying to use TA-lib on my Ubuntu 18.04 instance. I installed the package using
sudo ./configure sudo make sudo make install and then install ta-lib using pip install ta-lib
When I try to import talib, I got the following error:
import talib Traceback (most recent call last): File "
", line 1, in File "/home/user/user/virtualenv/lib/python3.7/site-packages/talib/init.py", line 52, in from ._ta_lib import ( File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject The only recommendation I found on internet was to install python 3.8 which isn't a possibility for me right now (to many dependencies on my project). Any idea what's the issue could be ? Thanks in advance.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
I had the same problem and could solve it by updating the numpy:
pip install --upgrade numpyI have ta-lib==0.4.24 and numpy==1.22.3
Hello, I'm trying to use TA-lib on my Ubuntu 18.04 instance. I installed the package using
sudo ./configure sudo make sudo make installand then install ta-lib using pip install ta-lib When I try to import talib, I got the following error:
>>> import talib Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/user/virtualenv/lib/python3.7/site-packages/talib/__init__.py", line 52, in <module> from ._ta_lib import ( File "talib/_ta_lib.pyx", line 1, in init talib._ta_lib ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObjectThe only recommendation I found on internet was to install python 3.8 which isn't a possibility for me right now (to many dependencies on my project). Any idea what's the issue could be ? Thanks in advance.
its WORKED with me :) Thank you
Same, pip install --upgrade numpy solved it for me. I had 1.20.3 and upgraded to 1.23.4