Cant make opencv work on heroku

风流意气都作罢 提交于 2020-12-29 06:46:08

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/46596267/cant-make-opencv-work-on-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!