現象
!pip install TA-Lib
Collecting TA-Lib
Using cached ta_lib-0.6.0.tar.gz (371 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from TA-Lib) (75.1.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from TA-Lib) (1.26.4)
Building wheels for collected packages: TA-Lib
error: subprocess-exited-with-error
× Building wheel for TA-Lib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for TA-Lib (pyproject.toml) ... error
ERROR: Failed building wheel for TA-Lib
Failed to build TA-Lib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (TA-Lib)
この時点でエラー
ライブラリのインストール
ta-libはソースコードからインストール これは以前と同じ
!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/
!./configure --prefix=/usr
!make
!sudo make install
これが自動的に行われなくなってた
!echo "/usr/lib" >> /etc/ld.so.conf
!ldconfig
確認
!ldconfig -p | grep ta_lib
libta_lib.so.0 (libc6,x86-64) => /usr/lib/libta_lib.so.0
libta_lib.so (libc6,x86-64) => /usr/lib/libta_lib.so
ここまでできたら次へ
TA-Libのインストール
バージョンを指定してインストール 0.6.0はだめっぽいから0.5.0をインストール
!python -m pip install git+https://github.com/TA-Lib/ta-lib-python.git@TA_Lib-0.5.0
Collecting git+https://github.com/TA-Lib/ta-lib-python.git@TA_Lib-0.5.0
Cloning https://github.com/TA-Lib/ta-lib-python.git (to revision TA_Lib-0.5.0) to /tmp/pip-req-build-bchzh4y5
Running command git clone --filter=blob:none --quiet https://github.com/TA-Lib/ta-lib-python.git /tmp/pip-req-build-bchzh4y5
Running command git checkout -q 1582434101ee5387765c0dee97f5b4a465f78458
Resolved https://github.com/TA-Lib/ta-lib-python.git to commit 1582434101ee5387765c0dee97f5b4a465f78458
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from ta-lib==0.5.0) (1.26.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.5.0-cp310-cp310-linux_x86_64.whl size=2385774 sha256=4c11bba56e84977613bb74b48aa31f030e41337237cdceb6921c01a724972d5b
Stored in directory: /tmp/pip-ephem-wheel-cache-k99eacu8/wheels/2d/f9/54/5b4c39b0b9a0a2482828299331f69df93fc59dadce83e0622a
Successfully built ta-lib
Installing collected packages: ta-lib
Attempting uninstall: ta-lib
Found existing installation: TA-Lib 0.4.26
Uninstalling TA-Lib-0.4.26:
Successfully uninstalled TA-Lib-0.4.26
Successfully installed ta-lib-0.5.0
古いバージョンをインストールするときはこう
!python -m pip install git+https://github.com/TA-Lib/ta-lib-python.git@TA_Lib-0.4.26