I've installed .venv
into my python project. I've activated it and then installed from requirments:
python -m venv .ven
.\.ven\Scripts\activate
pip3 install -r requirements.txt
when i run pip3 list
i see all packages installed. Nevertheless when trying to run my application i see:
Traceback (most recent call last):
File "d:/Projekty/_Python/therobertseye/app.py", line 1, in <module>
from website import create_app
File "d:\Projekty\_Python\therobertseye\website\__init__.py", line 1, in <module>
from flask import Flask
ModuleNotFoundError: No module named 'flask'
in my _init.py:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from os import path
from flask_login import LoginManager
but its not only Flask
- when i did remove for testing purpose :
from flask import Flask
then when ran again i see:
Traceback (most recent call last):
File "d:/Projekty/_Python/therobertseye/app.py", line 1, in <module>
from website import create_app
File "d:\Projekty\_Python\therobertseye\website\__init__.py", line 1, in <module>
from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'
Means none of my packages are visible. Looks like libraries in venv are not visible? How can i sovle it?
I run my project from app.py by python3.8.exe app.py
app.py:
from website import create_app
app = create_app()
if __name__ == '__main__':
app.run(debug=True)
EDIT: as stated by @np8 both commands works on local:
python app.py
.\.ven\Scripts\python.exe app.py
Nevertheless when deployed on Azure i got errors in log:
021-12-11T10:11:56.228062960Z from website.Barcode import Barcode
2021-12-11T10:11:56.228068661Z File "/tmp/8d9bc8c8ae34714/website/Barcode.py", line 2, in <module>
2021-12-11T10:11:56.228074361Z import cv2
2021-12-11T10:11:56.228079661Z File "/tmp/8d9bc8c8ae34714/antenv/lib/python3.8/site-packages/cv2/__init__.py", line 8, in <module>
2021-12-11T10:11:56.228085161Z from .cv2 import *
2021-12-11T10:11:56.228090161Z ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2021-12-11T10:11:56.228096061Z [2021-12-11 10:11:56 +0000] [41] [INFO] Worker exiting (pid: 41)
2021-12-11T10:11:56.497660146Z [2021-12-11 10:11:56 +0000] [39] [INFO] Shutting down: Master
2021-12-11T10:11:56.497793247Z [2021-12-11 10:11:56 +0000] [39] [INFO] Reason: Worker failed to boot.
/home/LogFiles/2021_12_11_10-30-0-5_docker.log