From 2b09f01293401a18d3306dff6e1f536eba75a785 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Mon, 30 Jan 2023 18:52:56 -0300 Subject: [PATCH 1/7] Fixes gym issue https://github.com/freqtrade/freqtrade/issues/8078 --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index e6b5ca464..0d177725f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,6 +23,8 @@ tables==3.8.0 blosc==1.11.1 joblib==1.2.0 pyarrow==11.0.0; platform_machine != 'armv7l' +# Fixes issue where gym cannot be installed - https://github.com/pypa/setuptools/issues/3801 +setuptools==65.5.0 # find first, C search in arrays py_find_1st==1.1.5 From 8b307357f30694527708ba877b143b1c514141b5 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Tue, 31 Jan 2023 12:09:14 -0300 Subject: [PATCH 2/7] Add to setup --- requirements-freqai-rl.txt | 1 + setup.sh | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index 82ff4022d..cb77a34c1 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -6,4 +6,5 @@ torch==1.13.1 stable-baselines3==1.7.0 sb3-contrib==1.7.0 # Gym is forced to this version by stable-baselines3. +setuptools==65.5.0 # Should be removed when gym is fixed. gym==0.21 diff --git a/setup.sh b/setup.sh index 4cb504853..846d9e2a9 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,30 @@ #!/usr/bin/env bash #encoding=utf8 +# This should be deleted as soon as a gym release with a fixed setuptools is made +function check_is_new_setuptools_installed() { + stoolversion=$(${PYTHON} -m pip show setuptools | grep "Version:") + stoolversion=${stoolversion##* } + stoolversion=$(echo $stoolversion | grep -Eo "^[0-9]+") + + if [ $stoolversion -gt 65 ]; then + echo "You are using a new version of setuptools. This is not supported by gym at the moment." + read -p "Do you want to downgrade setuptools to a version that is supported by gym? [y/N] " + + if [[ $REPLY =~ ^[Yy]$ ]] + then + ${PYTHON} -m pip install setuptools==65.5.0 + if [ $? -ne 0 ]; then + echo "Failed downgrading setuptools" + exit 1 + fi + else + echo "Please downgrade setuptools to a version that is supported by gym." + exit 1 + fi + fi +} + function echo_block() { echo "----------------------------" echo $1 @@ -60,7 +84,7 @@ function updateenv() { fi REQUIREMENTS_HYPEROPT="" REQUIREMENTS_PLOT="" - read -p "Do you want to install plotting dependencies (plotly) [y/N]? " + read -p "Do you want to install plotting dependencies (plotly) [y/N]? " if [[ $REPLY =~ ^[Yy]$ ]] then REQUIREMENTS_PLOT="-r requirements-plot.txt" @@ -278,6 +302,7 @@ function help() { # Verify if 3.8+ is installed check_installed_python +check_is_new_setuptools_installed case $* in --install|-i) From 592eebe51626f2ab243d3c237cbfdbfaa13e3a35 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Tue, 31 Jan 2023 12:10:41 -0300 Subject: [PATCH 3/7] Add to setup --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0d177725f..e6b5ca464 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,8 +23,6 @@ tables==3.8.0 blosc==1.11.1 joblib==1.2.0 pyarrow==11.0.0; platform_machine != 'armv7l' -# Fixes issue where gym cannot be installed - https://github.com/pypa/setuptools/issues/3801 -setuptools==65.5.0 # find first, C search in arrays py_find_1st==1.1.5 From baf2090f9efe8693058b096d0e39e4e18ee6ce46 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Tue, 31 Jan 2023 12:42:39 -0300 Subject: [PATCH 4/7] Just change the docs --- docs/installation.md | 6 ++++++ setup.sh | 25 ------------------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 9dd14274a..eced8d75b 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -30,6 +30,12 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito !!! Warning "Up-to-date clock" The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges. +!!! Error: Running setup.py install for gym did not run successfully. + If you get an error related with gym we suggest you to downgrade it to version 65.5.0 you can do it with the following command: + ```bash + pip install setuptools==65.5.0 + ``` + ------ ## Requirements diff --git a/setup.sh b/setup.sh index 846d9e2a9..88f97ec63 100755 --- a/setup.sh +++ b/setup.sh @@ -1,30 +1,6 @@ #!/usr/bin/env bash #encoding=utf8 -# This should be deleted as soon as a gym release with a fixed setuptools is made -function check_is_new_setuptools_installed() { - stoolversion=$(${PYTHON} -m pip show setuptools | grep "Version:") - stoolversion=${stoolversion##* } - stoolversion=$(echo $stoolversion | grep -Eo "^[0-9]+") - - if [ $stoolversion -gt 65 ]; then - echo "You are using a new version of setuptools. This is not supported by gym at the moment." - read -p "Do you want to downgrade setuptools to a version that is supported by gym? [y/N] " - - if [[ $REPLY =~ ^[Yy]$ ]] - then - ${PYTHON} -m pip install setuptools==65.5.0 - if [ $? -ne 0 ]; then - echo "Failed downgrading setuptools" - exit 1 - fi - else - echo "Please downgrade setuptools to a version that is supported by gym." - exit 1 - fi - fi -} - function echo_block() { echo "----------------------------" echo $1 @@ -302,7 +278,6 @@ function help() { # Verify if 3.8+ is installed check_installed_python -check_is_new_setuptools_installed case $* in --install|-i) From 152aa994a66d370d904d4795440943bea6a58a89 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Tue, 31 Jan 2023 12:46:21 -0300 Subject: [PATCH 5/7] Fix test --- docs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index eced8d75b..793e86319 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -31,7 +31,7 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges. !!! Error: Running setup.py install for gym did not run successfully. - If you get an error related with gym we suggest you to downgrade it to version 65.5.0 you can do it with the following command: + If you get an error related with gym we suggest you to downgrade setuptools it to version 65.5.0 you can do it with the following command: ```bash pip install setuptools==65.5.0 ``` From 839215c43725110f704e6463698339916cff5745 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 31 Jan 2023 20:58:20 +0100 Subject: [PATCH 6/7] Fix Doc box error --- docs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.md b/docs/installation.md index 793e86319..1c0aed7ba 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -30,7 +30,7 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito !!! Warning "Up-to-date clock" The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges. -!!! Error: Running setup.py install for gym did not run successfully. +!!! Error "Running setup.py install for gym did not run successfully." If you get an error related with gym we suggest you to downgrade setuptools it to version 65.5.0 you can do it with the following command: ```bash pip install setuptools==65.5.0 From 322d4b53510e27b9f79eed781449412878bab1fc Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 1 Feb 2023 09:20:40 +0000 Subject: [PATCH 7/7] improve fix for setup.sh --- setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 88f97ec63..6a6744cef 100755 --- a/setup.sh +++ b/setup.sh @@ -49,7 +49,8 @@ function updateenv() { source .env/bin/activate SYS_ARCH=$(uname -m) echo "pip install in-progress. Please wait..." - ${PYTHON} -m pip install --upgrade pip + # Setuptools 65.5.0 is the last version that can install gym==0.21.0 + ${PYTHON} -m pip install --upgrade pip wheel setuptools==65.5.0 read -p "Do you want to install dependencies for dev [y/N]? " dev=$REPLY if [[ $REPLY =~ ^[Yy]$ ]]