LTDB requirements and virtualenv

This is probably a bash/virtualenv question, not really an LTDB question, my apologies…

I am a bit confused about how I am supposed to set up and use virtual environments for LTDB.

It comes with a requirements.txt, and in deploy.sh, it either looks for .venv or it creates it:

#!/bin/bash

if [ -d ".venv" ]
then
    source .venv/bin/activate
    pip install -r requirements.txt
    python3 wsgi.py
else
    python3 -m venv .venv
    source .venv/bin/activate
    python3 -m pip install --upgrade pip
    pip install -r requirements.txt
    python3 wsgi.py
fi

Suppose I do not yet have .venv on my machine (update: of course I have it, it is hidden though); I am able to run deploy.sh and LTDB works, although I do see the following error message:

$ ./deploy.sh 
./deploy.sh: /home/olga/delphin/tools/ltdb/.venv/bin/pip: /home/olga/delphin/tools/ltdb/.venv/bin/python3: bad interpreter: No such file or directory
 * Serving Flask app "web" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with inotify reloader
 * Debugger is active!
 * Debugger PIN: 142-413-332

(scroll to see the “No such file or directory” error message).

I get this same error message if I run the command separately:

$ python3 -m venv .venv
Error: [Errno 2] No such file or directory: '/home/olga/delphin/tools/ltdb/.venv/bin/python3': '/home/olga/delphin/tools/ltdb/.venv/bin/python3'

I can create a virtual environment using other means, such as conda, and install the requirements. And that way, I can run scripts such as grm2db.py. But then I cannot run deploy.sh. So I am confused about what is going on; how can I create a virtual environment which works for deploy, and how is it working without the requirements (presumably), if the command fails?..

Ah, of course I do have a .venv, it’s just hidden.

Still, I don’t understand how to e.g. debug the app, because my IDE is unhappy about this environment:

And if I try to use another (which has the exact same requirements satisfied), I get the following error:

  File "/home/olga/delphin/tools/ltdb/venv/lib/python3.8/site-packages/flask/__init__.py", line 5, in <module>
    from . import json as json
  File "/home/olga/delphin/tools/ltdb/venv/lib/python3.8/site-packages/flask/json/__init__.py", line 6, in <module>
    from ..globals import current_app
  File "/home/olga/delphin/tools/ltdb/venv/lib/python3.8/site-packages/flask/globals.py", line 25, in <module>
    app_ctx: AppContext = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'
python-BaseException

Nevermind; the whole issue was forgetting to upgrade pip I think. And the general confusion with a couple of virtual environments, one called .venv and the other called venv.

Executing everything that is in deploy.sh in any new environment works.