0

So when i try to run my heroku api by doing heroku ps i get the error below. and by looking at it heroku has some problems importing opencv which i find weird as it already installed it when i pushed the git. how do i allow heroku to import opencv?

2022-06-29T03:21:43.020891+00:00 app[web.1]: native_module = importlib.import_module("cv2")
2022-06-29T03:21:43.020891+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2022-06-29T03:21:43.020892+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-06-29T03:21:43.020892+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2022-06-29T03:21:43.021032+00:00 app[web.1]: [2022-06-29 03:21:43 +0000] [9] [INFO] Worker exiting (pid: 9)
2022-06-29T03:21:43.151897+00:00 app[web.1]: [2022-06-29 03:21:43 +0000] [4] [INFO] Shutting down: Master
2022-06-29T03:21:43.151941+00:00 app[web.1]: [2022-06-29 03:21:43 +0000] [4] [INFO] Reason: Worker failed to boot.
2022-06-29T03:21:43.307090+00:00 heroku[web.1]: Process exited with status 3
2022-06-29T03:21:43.377211+00:00 heroku[web.1]: State changed from starting to crashed
bam mazino
  • 21
  • 2
  • Can you share your requirements.txt file? Should it be in there? – JBallin Jun 29 '22 at 03:57
  • check this solution. you might use apt to install missing library https://stackoverflow.com/a/51004957/1079086 – Akash senta Jun 29 '22 at 04:20
  • you need the "headless" opencv version: `opencv-python-headless` (which has less dependencies) – berak Jun 29 '22 at 06:04
  • when i use the headless opencv i get ``` Collecting flask remote: Downloading Flask-2.1.2-py3-none-any.whl (95 kB) remote: ERROR: Could not find a version that satisfies the requirement gunicord (from versions: none) remote: ERROR: No matching distribution found for gunicord remote: ! Push rejected, failed to compile Python app.``` which i think means that flask can't be installed due to opencv – bam mazino Jun 29 '22 at 12:52
  • nvm i got it to work by adding a apt file – bam mazino Jun 29 '22 at 13:03

0 Answers0