From 24f1dc4ecc08ac30fac3f507e342e8d560d65a8c Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 14 Aug 2022 09:06:04 +0200 Subject: [PATCH] Update patched ta-lib install for conda --- .gitignore | 1 + build_helpers/install_ta-lib.sh | 16 +++++++++++----- build_helpers/install_ta-lib_conda.sh | 21 --------------------- docs/installation.md | 7 +++++-- 4 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 build_helpers/install_ta-lib_conda.sh diff --git a/.gitignore b/.gitignore index d6cec5225..065ac1f68 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ user_data/notebooks/* freqtrade-plot.html freqtrade-profit-plot.html freqtrade/rpc/api_server/ui/* +build_helpers/ta-lib/* # Macos related .DS_Store diff --git a/build_helpers/install_ta-lib.sh b/build_helpers/install_ta-lib.sh index 00c4417ae..581c1cd41 100755 --- a/build_helpers/install_ta-lib.sh +++ b/build_helpers/install_ta-lib.sh @@ -4,7 +4,7 @@ else INSTALL_LOC=${1} fi echo "Installing to ${INSTALL_LOC}" -if [ ! -f "${INSTALL_LOC}/lib/libta_lib.a" ]; then +if [ -n "$2" ] && [ ! -f "${INSTALL_LOC}/lib/libta_lib.a" ]; then tar zxvf ta-lib-0.4.0-src.tar.gz cd ta-lib \ && sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \ @@ -17,11 +17,17 @@ if [ ! -f "${INSTALL_LOC}/lib/libta_lib.a" ]; then cd .. && rm -rf ./ta-lib/ exit 1 fi - which sudo && sudo make install || make install - if [ -x "$(command -v apt-get)" ]; then - echo "Updating library path using ldconfig" - sudo ldconfig + if [ -z "$2" ]; then + which sudo && sudo make install || make install + if [ -x "$(command -v apt-get)" ]; then + echo "Updating library path using ldconfig" + sudo ldconfig + fi + else + # Don't install with sudo + make install fi + cd .. && rm -rf ./ta-lib/ else echo "TA-lib already installed, skipping installation" diff --git a/build_helpers/install_ta-lib_conda.sh b/build_helpers/install_ta-lib_conda.sh deleted file mode 100644 index 27f8a50a1..000000000 --- a/build_helpers/install_ta-lib_conda.sh +++ /dev/null @@ -1,21 +0,0 @@ -if ! [[ -v CONDA_PREFIX ]]; then - echo "The conda environment is not activated." - exit 1 -fi - -INSTALL_LOC=${CONDA_PREFIX} -echo "Installing to ${INSTALL_LOC}" -tar zxvf ta-lib-0.4.0-src.tar.gz -cd ta-lib \ -&& sed -i.bak "s|0.00000001|0.000000000000000001 |g" src/ta_func/ta_utility.h \ -&& curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -o config.guess \ -&& curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -o config.sub \ -&& ./configure --prefix=${INSTALL_LOC}/ \ -&& make -if [ $? -ne 0 ]; then - echo "Failed building ta-lib." - cd .. && rm -rf ./ta-lib/ - exit 1 -fi -make install || make install -cd .. && rm -rf ./ta-lib/ diff --git a/docs/installation.md b/docs/installation.md index 29511384c..9dd14274a 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -326,11 +326,14 @@ python3 -m pip install --upgrade pip python3 -m pip install -e . ``` -Patch conda libta-lib +Patch conda libta-lib (Linux only) ```bash +# Ensure that the environment is active! +conda activate freqtrade-conda + cd build_helpers -bash install_ta-lib_conda.sh +bash install_ta-lib.sh ${CONDA_PREFIX} nosudo ``` ### Congratulations