Closed KPCA1994 closed 1 year ago
The easiest fix is updating your numpy to a newer version.
It is true that I generate the C files with a recent version of numpy, so if you want to try using your existing numpy, you can: git checkout ta-lib-python, delete the C files, or regenerate them with make cython
, and then python setup.py install
...
Downloading TA-Lib-0.4.26.tar.gz (272 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 272.6/272.6 kB 9.7 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: numpy in /usr/local/lib/python3.9/dist-packages (from TA-Lib) (1.22.4) Building wheels for collected packages: TA-Lib Building wheel for TA-Lib (pyproject.toml) ... done Created wheel for TA-Lib: filename=TA_Lib-0.4.26-cp39-cp39-linux_x86_64.whl size=2261745 sha256=9afadc9f64c61100d533468664d83a39ea616a7a94da435595ed611c12aacc88 Stored in directory: /root/.cache/pip/wheels/05/d1/3c/8846d2115d6b73b448af7f8e361bf267a1d82b87e318bc18cb Successfully built TA-Lib Installing collected packages: TA-Lib Successfully installed TA-Lib-0.4.26
I have latest numpy still getting the same error
@chattel-tech
It looks like you have numpy 1.22.4? I think latest is 1.23.2.
When you say getting the same error, it's on import of ta-lib?
[Google Colab]Execute in order
!pip install numpy==1.23.2
OR !pip install --upgrade numpy
Restart execution phase [Ctrl+M .]
install Ta-Lib
import talib
@KPCA1994 @uirty @mrjbq7 May I ask if this problem has been solved? Because I also have the same problem.
The following procedure can be executed on the google colab platform to install Talib completely, but there will be an exception at the import stage.
install talib ''''''''''''''' !wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz !tar -xzvf ta-lib-0.4.0-src.tar.gz %cd ta-lib !./configure --prefix=/usr !make !make install !pip install TA-lib
url = 'https://anaconda.org/conda-forge/libta-lib/0.4.0/download/linux-64/libta-lib-0.4.0-h166bdaf_1.tar.bz2' !curl -L $url | tar xj -C /usr/lib/x86_64-linux-gnu/ lib --strip-components=1 url = 'https://anaconda.org/conda-forge/ta-lib/0.4.19/download/linux-64/ta-lib-0.4.19-py39hd257fcd_4.tar.bz2'#!curl -L $url | tar xj -C /usr/local/lib/python3.10/dist-packages/ lib/python3.10/site-packages/talib --strip-components=3 !curl -L $url | tar xj -C /usr/local/lib/python3.10/dist-packages/talib --strip-components=3
!pip install numpy==1.23.2 import talib ''''''''''''''''''''''
RuntimeError Traceback (most recent call last) init.pxd in numpy.import_array()
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem .
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/talib/init.py in
talib/_func.pxi in init talib._ta_lib()
init.pxd in numpy.import_array()
ImportError: numpy.core.multiarray failed to import
'''''''''''''''''''''
Issue still exists in google colab. Working fine in jupyter notebook with latest numpy version.
@rarben I don't understand why you can't use it, I don't have an abnormal condition.
!pip install pandas
!pip install numpy==1.23.2
!pip install FinMind
!pip install yfinance
!pip install mplfinance
!pip install lineTool
!pip install requests
Restart execution phase [Ctrl+M .]
!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzf ta-lib-0.4.0-src.tar.gz
%cd ta-lib
!rm -rf *.so
!rm -rf *.c
!./configure --prefix=/usr
!make
!make install
!pip install Ta-Lib
import talib
@uirty working fine with your code. Closing the issue.
Unable to import talib in Google Colab. Getting error