I'm trying to make opencv work on Heroku but i have the following error on the server's log file :
2017-10-05T23:17:08.145096+00:00 heroku[web.1]: State changed from crashed to starting
2017-10-05T23:17:19.477843+00:00 heroku[web.1]: Starting process with command `python Main.py`
2017-10-05T23:17:23.469550+00:00 heroku[web.1]: State changed from starting to crashed
2017-10-05T23:17:23.458477+00:00 heroku[web.1]: Process exited with status 1
2017-10-05T23:17:23.268234+00:00 app[web.1]: Traceback (most recent call last):
2017-10-05T23:17:23.268249+00:00 app[web.1]: File "Main.py", line 3, in <module>
2017-10-05T23:17:23.268434+00:00 app[web.1]: from MostDominantColor import get_color
2017-10-05T23:17:23.268541+00:00 app[web.1]: File "/app/utils.py", line 3, in <module>
2017-10-05T23:17:23.268435+00:00 app[web.1]: File "/app/MostDominantColor.py", line 2, in <module>
2017-10-05T23:17:23.268538+00:00 app[web.1]: import utils
2017-10-05T23:17:23.268648+00:00 app[web.1]: import cv2
2017-10-05T23:17:23.268790+00:00 app[web.1]: ImportError: libSM.so.6: cannot open shared object file: No such file or directory
2017-10-05T23:17:23.268663+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/cv2/__init__.py", line 9, in <module>
2017-10-05T23:17:23.268776+00:00 app[web.1]: from .cv2 import *
On line 9 of the __init__.py file there is a piece of code that is only useful for IDE's autocompletion :
8 # make IDE's (PyCharm) autocompletion happy
9 from .cv2 import *
I understand that this line is causing a problem when importing cv2 in my code, is there a way to delete the line from the server (knowing that cv2 library is downloaded by pip on the server side so i can't just push such an edit to Heroku via git)
Any suggestion is welcomed !
python : 3.6.2
opencv-python==3.3.0.10
It is required since opencv has some additional dependencies that are not installed on heroku by default and needs to be installed manually. These dependencies can be installed by using linux commands sudo apt get install or sudo apt install.
importerror no module named cv2 error occurs when cv2 module is not properly installed or its path is not properly set or configured. The straight way fix for this error (no module named cv2) is to reinstall this module (OpenCV-python).
It was a dependency problem, what i needed is to install this:
apt-get install libsm6 libxrender1 libfontconfig1
Ps: Heroku's Free account doesn't include ssh connexion so i switched to Google Cloud Platfom and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With