I am trying to deploy an app that uses opencv. I have tried all the permutations so far by adding “opencv-python-headless” / “opencv-python” or “opencv-contrib-python”. I have also added packages.txt to remove the error “libGL.so.1: cannot open shared object file: No such file or directory”.
But still below error exists no matter what I try .
Traceback (most recent call last):
File "detect.py", line 14, in <module>
ModuleNotFoundError: No module named 'cv2'
Contents of requirements.txt:
contents of packages.txt:
Kindly assist me in resolving the issue so that this error does not occur. Also, I have followed through other similar issues.
The error is caused by line 137 of your app, where you run a Python script in a subprocess.
The packages in your requirements file are installed in a virtual environment. The Python binary used in this virtual env is found at /home/appuser/venv/bin/python
In line 137 of your app, you run python detect.py --weights ... via a subprocess. This Python binary is not the one used in the virtual env where your packages, including opencv-python-headless , are installed.