opencv_aws_lambda icon indicating copy to clipboard operation
opencv_aws_lambda copied to clipboard

ModuleNotFoundError: No module named 'skbuild'

Open timo-a opened this issue 4 years ago • 5 comments

When I run

git clone https://github.com/iandow/opencv_aws_lambda
cd opencv_aws_lambda
docker build --tag=lambda-layer-factory:latest .

I get

....
Step 15/23 : RUN pip3.7 install -r /packages/requirements.txt -t /packages/opencv-python-3.7/python/lib/python3.7/site-packages
 ---> Running in afb13501cbed
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3.7 install --user` instead.
Collecting opencv-python (from -r /packages/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/77/f5/49f034f8d109efcf9b7e98fbc051878b83b2f02a1c73f92bbd37f317288e/opencv-python-4.4.0.42.tar.gz (88.9MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-vw_fikpx/opencv-python/setup.py", line 9, in <module>
        import skbuild
    ModuleNotFoundError: No module named 'skbuild'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vw_fikpx/opencv-python/
The command '/bin/sh -c pip3.7 install -r /packages/requirements.txt -t /packages/opencv-python-3.7/python/lib/python3.7/site-packages' returned a non-zero code: 1

timo-a avatar Aug 22 '20 00:08 timo-a

Needs a line to upgrade pip version

According to: https://pypi.org/project/opencv-python/

RUN pip3.7 install --upgrade pip
RUN pip3.8 install --upgrade pip

mhkey avatar Sep 22 '20 15:09 mhkey

@timo-a Can I know how you solve this problem???

adriantang avatar Oct 29 '20 02:10 adriantang

Using the pip upgrade would fix this error but using python-opencv requires to install libGL in the latest version. I will open a new ticket with this.

dioh avatar Oct 30 '20 17:10 dioh

Has anyone been able to fix this error? As @dioh mentioned, libGL is required in the newer version, which is missing in the Amazon linux 2 filesystem used in Lambda. I tried using the original version of opencv-python closest to the date this repo was last updated (3.4.8.29) but I still got the

"Unable to import module 'lambda_function': libgthread-2.0.so.0: cannot open shared object file: No such file or directory"

Any ideas what to do? I'm only sticking to the 3.8 version but I doubt that has any impact on this

EDIT:

It actually seems like this is an issue for python 3.8, python 3.7 seems to work just fine. This is probably because of the fact that 3.8 runtimes uses the amazon linux 2 image compared to lamazon linux for 3.7 and below...

amirhmk avatar Dec 01 '20 01:12 amirhmk

Using this package on Serverless helped me streamline this whole process and reduce the package size as well. Would definitely recommend checking it out. Make sure to leave the strip flag to false

Serverless python-requirements plugin

amirhmk avatar Dec 03 '20 00:12 amirhmk