How to use OpenCV with Heroku

后端 未结 5 1758
渐次进展
渐次进展 2020-12-09 06:07

When I attempt to deploy my application to Heroku I receive the following error:

File \"/app/project/app/_ _init__.py\", line 22, in 

        
相关标签:
5条回答
  • 2020-12-09 06:39

    Use opencv-python-headless as it is out of libSM6 dependency. check this out.

    opencv-python-headless==4.2.0.32
    
    0 讨论(0)
  • 2020-12-09 06:47

    You can install these missing libraries taking advantage of the heroku-buildpack-apt.

    At the time of this writing, I have succesfully done it for this repo, hosted here, with the following steps:

    1. Add heroku-buildpack-apt to your buildpacks on Heroku platform
    2. Create a file named Aptfile and add the following libs: libsm6, libxrender1, libfontconfig1, libice6 (one per line). Example here.

    Edit: in newer versions of OpenCV, you need only to list python-opencv on the Aptfile, as seen in the docs.

    0 讨论(0)
  • 2020-12-09 06:48

    For windows users, be sure to use unix style line endings in the Aptfile when following @Lelo suggestion above

    0 讨论(0)
  • 2020-12-09 06:49

    you should install libsm6 and libxext6, run

    $ sudo apt-get install -y libsm6 libxext6
    

    but, since heroku doesn't provide root access, sort answer, you can't do that. you can choose another provider like Google Cloud Platform or AWS

    cmiiw

    0 讨论(0)
  • 2020-12-09 06:59

    Referring to Lelo's answer regarding the installation of libraries, OpenCV has changed their required libraries (4.4.0 at the time of writing).

    Hence, to get the latest ones, you just need python-opencv in the Aptfile instead of the other libraries.

    This was referred to Install OpenCV-Python in Ubuntu.

    0 讨论(0)
提交回复
热议问题