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?..