cdli-gh / cdli-cts-server

Canonical Text Services api server.
GNU General Public License v3.0
0 stars 1 forks source link

Error when running `pipenv run pytest` #13

Open marktani opened 1 year ago

marktani commented 1 year ago

Following the instructions from README, when running pipenv run pytest this is my output:

ImportError while importing test module '/Users/nilan/projects/cdli-cts-server/test_app.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_app.py:4: in <module>
    import main
main.py:11: in <module>
    from capitains_nautilus.cts.resolver import NautilusCTSResolver
../../.local/share/virtualenvs/cdli-cts-server-9o7IsoQ-/lib/python3.9/site-packages/capitains_nautilus/cts/resolver.py:4: in <module>
    from werkzeug.contrib.cache import NullCache
E   ModuleNotFoundError: No module named 'werkzeug.contrib'

It looks like werkzeug.contrib has been removed in some versions after 0.16.0 (see here for example), so the proposed solution is this:

pip uninstall werkzeug
pip install werkzeug==0.16.0

resulting in the following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
flask 2.2.3 requires Werkzeug>=2.2.2, but you have werkzeug 0.16.0 which is incompatible.

Ok, so we also need to adjust flask to an older version.

I continued to dig for some versions that work well with each other and this example, but I have had no luck.

rillian commented 1 year ago

Yeah, things have bit-rotted pretty badly. I hoped having pipenv.lock in the repo would record a working configuration, but I can't figure out how to update the python version without it bumping everything else.

Even when I run a python:3.7 container image, I still get the werkzeug.contrib error. It looks like capitains-nautilus needs porting to the stable release.

marktani commented 1 year ago

I was able to find a working version combination with the latest, unpublished capitains-nautilus@dev (see the issue you linked for exact steps how to install that as a submodule).

Here is the working requirements.txt and the resulting frozen requirements after installing everything working_requirements.txt.