IBM-Cloud / ibm-cloud-cli-release

Apache License 2.0
154 stars 76 forks source link

How to upload Python function with virtualenv to IBM cloud #47

Closed Borisboky closed 6 years ago

Borisboky commented 6 years ago

I'm trying to add a python function to IBM Cloud.

I use scrapy library and requests, thus following the docs I need to create a .zip file with __main__.py, helpers.py files and virtualenv.

I did it with

zip -r test.zip __main__.py helper.py virtualenv

And the zip file is created, but the problem is that the file to big is and I can't upload it to IBM. I asked about it here.

Those two .py files (__main__.py helper.py) are very small, thus the problem is in virtualenv. I need to compress it or do something to decrease the size of it.

I've created it with:

virtualenv virtualenv

It installed default dependencies. And I've installed two extra libraries with pip, thus:

pip install requests==2.18.4
pip install Scrapy==1.5.0

I need those two.

With that virtualenv the created zip file is too big.

I know that that the problem is, because if I create a .zip file without virtualenv it uploads without problems.

Thus is there any way to solve my problem and to be able to upload it to IBM?

boyang9527 commented 6 years ago

@mdeuser@us.ibm.com, can you help here?

mdeuser commented 6 years ago

@boyang9527 there was a work around response in stack overflow

I am one of the guys responsible for IBM Cloud Functions. We have been looking into this issue and must admit that this is a bug (causing zip files to be rejected even if the are smaller than the documented 48MB limit); we are already working on a fix to get this resolved asap.

In the meantime you may want to have a look at the workaround (which allows you to "outsource" some of your dependencies etc.) described here: http://jamesthom.as/blog/2017/08/04/large-applications-on-openwhisk/

I hope this helps - feel free to contact me (e.g. via Linkedin/Twitter, see my profile information) directly in case you have further questions or in case you want to discuss anything else.

Thanks for having found and reported this issue and sorry for inconvenience.
boyang9527 commented 6 years ago

thanks @mdeuser !