简体   繁体   中英

How to upload Python function with virtualenv to IBM cloud

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 decrease the size or to solve my problem and to be able to upload it to IBM?

I assume your file size is still below the actual 48MB limit, right?

If so, we are still working on fixing this so that files - even zip files - smaller than 48MB can be uploaded again as I gave explained here: IBM Cloud functions - Unable to create an action

I will def. let you know once we have the fix in place.

Besides that, you have tried to upload your dependencies to Dockerhub uploading only the actual action code to IBM Cloud Functions as explained here: http://jamesthom.as/blog/2017/08/04/large-applications-on-openwhisk/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM