How To Use Opencv With Heroku
Solution 1:
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:
- Add heroku-buildpack-apt to your buildpacks on Heroku platform
- 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.
Solution 2:
Use opencv-python-headless as it is out of libSM6 dependency. check this out. Add the following line your requirements.txt and remove the old open-cv entry:
opencv-python-headless==4.2.0.32
Solution 3:
New Aptfile and requirements.txt attributes works for me:
in Aptfile
libsm6
libxrender1
libfontconfig1
libice6
in requirements.txt
opencv-python-headless==4.2.0.32
Remember to have the Buildpack included in settings.
https://github.com/heroku/heroku-buildpack-apt
Solution 4:
For windows users, be sure to use unix style line endings in the Aptfile when following @Lelo suggestion above
Solution 5:
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.
Post a Comment for "How To Use Opencv With Heroku"