You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by Aro0oj <m....@hotmail.com> on 2022/03/04 14:04:17 UTC

Packaging Python action

Hi ,
I  have installed Lean OpenWhisk on raspberry pi 4 B with 32 OS (raspbain OS)

I have created python action in virtual env which using opencv library . First I try to pakckage  python code with folder Virtualenv and the size of that zip is more than 48MB .So I tried to only include the lib folder I need it with python code but when I create the action then invoke the action it shows me an error ( see the screenshot of the log of that action 





I have follow the same steps in this link : https://medium.com/openwhisk/python-packages-in-openwhisk-8d10dcd91257 <https://medium.com/openwhisk/python-packages-in-openwhisk-8d10dcd91257> section speed up deployment 



Best regards,
Areej 

Re: Packaging Python action

Posted by areej makki <m....@hotmail.com>.
[cid:09a0d6b4-0461-4693-a77e-a33de9a24ef9@EURP189.PROD.OUTLOOK.COM]

Hi ,


Thank you for your reply .

I have try to create custom python runtime (see attached  DokcerFile) with extra library  opencv  — I have add to the dockerfiel the same step in this link to install opencv lib on raspberry pi 4 B with 32 OS (raspbain OS)— https://qengineering.eu/install-opencv-4.5-on-raspberry-pi-4.html


 when I tried to create action using this runtime it is created Successfully but when I invoke it it showed me an error ( see screenshot)


(virtualenv) pi@rpi22:~/stream_project $ wsk action invoke Video_1 --result
{
    "error": "Cannot start action. Check logs for details."
}


(virtualenv) pi@rpi22:~/stream_project $ wsk activation logs 14e18704a4894b95a18704a489eb9561
2022-03-07T14:13:59.299101376Z stderr: Traceback (most recent call last):
2022-03-07T14:13:59.299240319Z stderr: File "/opencv/build/action/1/bin/exec__.py", line 44, in <module>
2022-03-07T14:13:59.299657148Z stderr: from main__ import main as main
2022-03-07T14:13:59.299701703Z stderr: File "/opencv/build/action/1/bin/main__.py", line 1, in <module>
2022-03-07T14:13:59.299876979Z stderr: import cv2
2022-03-07T14:13:59.300023644Z stderr: ModuleNotFoundError: No module named 'cv2'
2022-03-07T14:13:59.315269632Z stderr: Command exited abruptly during initialization.
On 5 Mar 2022, at 16:45, Rodric Rabbah <ro...@gmail.com>> wrote:

You will need to put the library in the docker image for that runtime. Then you don’t have to bundle it with the action.

-r

On Fri, Mar 4, 2022 at 9:04 AM Aro0oj <m....@hotmail.com>> wrote:
Hi ,
I  have installed Lean OpenWhisk on raspberry pi 4 B with 32 OS (raspbain OS)

I have created python action in virtual env which using opencv library . First I try to pakckage  python code with folder Virtualenv and the size of that zip is more than 48MB .So I tried to only include the lib folder I need it with python code but when I create the action then invoke the action it shows me an error ( see the screenshot of the log of that action


[cid:17f5af7ee9a28e406891]


I have follow the same steps in this link : https://medium.com/openwhisk/python-packages-in-openwhisk-8d10dcd91257 section speed up deployment



Best regards,
Areej


Re: Packaging Python action

Posted by Rodric Rabbah <ro...@gmail.com>.
You will need to put the library in the docker image for that runtime. Then
you don’t have to bundle it with the action.

-r

On Fri, Mar 4, 2022 at 9:04 AM Aro0oj <m....@hotmail.com> wrote:

> Hi ,
> I  have installed Lean OpenWhisk on raspberry pi 4 B with 32 OS (raspbain
> OS)
>
> I have created python action in virtual env which using opencv library .
> First I try to pakckage  python code with folder Virtualenv and the size of
> that zip is more than 48MB .So I tried to only include the lib folder I
> need it with python code but when I create the action then invoke the
> action it shows me an error ( see the screenshot of the log of that action
>
>
>
>
> I have follow the same steps in this link :
> https://medium.com/openwhisk/python-packages-in-openwhisk-8d10dcd91257 section
> speed up deployment
>
>
>
> Best regards,
> Areej
>