From f916beb3ca2993a76ef1203baa715be7295d2d82 Mon Sep 17 00:00:00 2001 From: lmerchant Date: Thu, 9 Jan 2025 13:20:31 -0800 Subject: [PATCH 1/5] Update pip and conda requirements to fix error when running server after repo install After installing the code in the repo according to steps in the README.md file, an error occurs when running the server with the command $ python microsetta_interface/server.py Error: ImportError: cannot import name 'final' from 'typing' (/usr/local/anaconda3/envs/microsetta-interface_test/lib/python3.7/typing.py) The error encountered occurs because the final feature was introduced in Python 3.8 and is not available in Python 3.7. The error occurs in async_timeout which depends on redis. The version of redis installed is 5.0.7. On the pypi page for redis, at https://pypi.org/project/redis/, this statement is found: ** Note: ** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached end of life. redis-py 5.1 will support Python 3.8+. Uninstalling redis and installing redis==4.6.0 fixes the error when starting the server. Used pip list and conda list to update the versions in pip_requirements.txt and conda_requirements.txt. Keeping the same packages in each requirement file with the updated versions resulted in an error with a fresh install and running the server. To fix the error, removed redis==4.6.0 from conda_requirements.txt because conda could not find this version of redis and put it in the pip_requirements.txt file. Also needed to add babel as a package to conda_requirements.xt since there was a ModuleNotFoundError for babel. Update flask-babel=2.0.0 in conda_requirements.txt to flask-babel==2.0.0 replace a single = to a double =. Remove pytest==5.3.3 from conda_requirements.txt since it is already in pip_requirements.txt. --- ci/conda_requirements.txt | 16 +++++++--------- ci/pip_requirements.txt | 17 +++++++++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 620d545a..48a63887 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1,9 +1,7 @@ -flake8 -flask < 3.0.0 -natsort -pycryptodome -redis-py -redis -pytest -flask-babel=2.0.0 -pandas +flake8==5.0.4 +flask==2.2.5 +natsort==8.4.0 +pycryptodome==3.15.0 +babel==2.14.0 +flask-babel==2.0.0 +pandas==1.3.5 diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index 9995be8a..61f49575 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -1,9 +1,10 @@ -openapi-spec-validator < 0.2.10 +openapi-spec-validator==0.2.9 swagger-ui-bundle==0.0.9 -connexion[swagger-ui] < 2.7.1 -pyjwt[crypto] < 2.2.0 -pytest < 5.3.4 -pytest-cov -coveralls -pycountry -python-dateutil +connexion[swagger-ui]==2.7.0 +pyjwt[crypto]==2.1.0 +pytest==5.3.3 +pytest-cov==4.1.0 +coveralls==3.3.1 +pycountry==22.3.5 +python-dateutil==2.9.0 +redis==4.6.0 From 5f5bf9d68801ff2c7402916dd1f89c49c0a28b9e Mon Sep 17 00:00:00 2001 From: lmerchant Date: Thu, 9 Jan 2025 16:38:06 -0800 Subject: [PATCH 2/5] Modify pip and conda requirements files Pin only the redis package. Set the version to 4.6.0 in pip_requirements.txt to fix error when running the server after an install Remove redis from conda_requirements.txt and place in pip_requirements.txt because conda can't locate the redis version 4.6.0. Remove pytest from conda_requirements.txt because it was not versioned and there is a versioned pytest < 5.3.4 in pip_requirements.txt. Add an equal sign to "flask-babel=2.0.0" in conda_requirements.txt to set the version using double equal signs. --- ci/conda_requirements.txt | 12 ++++++------ ci/pip_requirements.txt | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 48a63887..30de0537 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -1,7 +1,7 @@ -flake8==5.0.4 -flask==2.2.5 -natsort==8.4.0 -pycryptodome==3.15.0 -babel==2.14.0 +flake8 +flask < 3.0.0 +natsort +pycryptodome +redis-py flask-babel==2.0.0 -pandas==1.3.5 +pandas diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index 61f49575..af802e08 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -1,10 +1,10 @@ -openapi-spec-validator==0.2.9 +openapi-spec-validator < 0.2.10 swagger-ui-bundle==0.0.9 -connexion[swagger-ui]==2.7.0 -pyjwt[crypto]==2.1.0 -pytest==5.3.3 -pytest-cov==4.1.0 -coveralls==3.3.1 -pycountry==22.3.5 -python-dateutil==2.9.0 +connexion[swagger-ui] < 2.7.1 +pyjwt[crypto] < 2.2.0 +pytest < 5.3.4 +pytest-cov +coveralls +pycountry +python-dateutil redis==4.6.0 From 83a98ebfe23c9644e2ca7c3a6c05c2a898191582 Mon Sep 17 00:00:00 2001 From: lmerchant Date: Fri, 10 Jan 2025 15:34:50 -0800 Subject: [PATCH 3/5] Add redis-server with pip because conda install failed with more recent versions --- ci/pip_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index af802e08..a30c28b6 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -8,3 +8,4 @@ coveralls pycountry python-dateutil redis==4.6.0 +redis-server==6.0.9 From a38e9345bc4025677bc487b94c17336f807fa35b Mon Sep 17 00:00:00 2001 From: lmerchant Date: Mon, 13 Jan 2025 08:28:57 -0800 Subject: [PATCH 4/5] Update pip and conda requirements for python server to work in conda environ Remove redis-py and redis from coda requirements and add redis to pip_requirements.txt. It's not possible to install redis-server with pip or conda since it's not a python package. So the only install for redis is the client. Pip has a more current redis version than conda. With conda, redis needs to be < 5.0 and for pip, redis is 5.0.8. Having redis only in pip_requirements also follows the setup for microsetta-private-api where redis is in pip_requirements.txt and not in conda_requirements.txt. --- ci/conda_requirements.txt | 1 - ci/pip_requirements.txt | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 30de0537..9df29bd8 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -2,6 +2,5 @@ flake8 flask < 3.0.0 natsort pycryptodome -redis-py flask-babel==2.0.0 pandas diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index a30c28b6..88ca0674 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -7,5 +7,4 @@ pytest-cov coveralls pycountry python-dateutil -redis==4.6.0 -redis-server==6.0.9 +redis From ab7ba933591a6226d0cf4b3c226c666e8a5f2d06 Mon Sep 17 00:00:00 2001 From: lmerchant Date: Mon, 13 Jan 2025 13:24:08 -0800 Subject: [PATCH 5/5] Modify conda_requirements.txt to use redis-py < 5.0.0 to prevent error running server With redis-py not < 5.0, this error occurs when running the server: ImportError: cannot import name 'final' from 'typing' (/lib/python3.7/typing.py) --- ci/conda_requirements.txt | 2 ++ ci/pip_requirements.txt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/conda_requirements.txt b/ci/conda_requirements.txt index 9df29bd8..7b8b7e57 100644 --- a/ci/conda_requirements.txt +++ b/ci/conda_requirements.txt @@ -4,3 +4,5 @@ natsort pycryptodome flask-babel==2.0.0 pandas +redis +redis-py < 5.0.0 diff --git a/ci/pip_requirements.txt b/ci/pip_requirements.txt index 88ca0674..9995be8a 100644 --- a/ci/pip_requirements.txt +++ b/ci/pip_requirements.txt @@ -7,4 +7,3 @@ pytest-cov coveralls pycountry python-dateutil -redis