Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pip and conda requirements for python server to work in conda environ #336

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lmerchant
Copy link
Collaborator

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.

…ter 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.
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.
…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.
@wasade
Copy link
Member

wasade commented Jan 13, 2025

Note that conda is not specific to Python packages. conda-forge in particular is enriched for other pre-built binaries.

@lmerchant
Copy link
Collaborator Author

Thanks for clarifying that conda-forge carries other packages like redis-server. I've mainly used pyenv and not conda before.

And my Ubuntu installation of redis-server was first in the path over anaconda, so I made conda come first in my path. Now I see the conda install of redis-server.

The conda_requirements.txt file just needs redis-py < 5.0 for it to install and for the server to run.

I'll submit that change and hopefully the integration test will pass.

…r running server

With redis-py not < 5.0, this error occurs when running the server:
ImportError: cannot import name 'final' from 'typing' (<anaconda env dir>/lib/python3.7/typing.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants