Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable To Install Pandas on Cloud Function #28

Open
SushantVarshney opened this issue Jan 22, 2018 · 5 comments
Open

Unable To Install Pandas on Cloud Function #28

SushantVarshney opened this issue Jan 22, 2018 · 5 comments

Comments

@SushantVarshney
Copy link

Hi ,
I am trying to run my code over cloud-function which has a dependency of pandas in it.But after deploying the function and triggering it,facing the following error:

ImportError: C extension: No module named timedeltas not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first. Failed to execute script main

I am using
Python version 2.7
Pandas Version 0.22.0

and running below cmd:

sudo py-cloud-fn test-flask-bigquery1 http --python_version 2.7 -p -f main.py && cd cloudfn/target && gcloud beta functions deploy test-flask-bigquery1 --trigger-http --stage-bucket <bucketname> --memory 2048MB && cd ../..

Please provide the solution for this.

@MartinSahlen
Copy link
Owner

This seems to be an error with C extensions and building them for the cloud function. It might be an easy task, it might not but I don't currently have a solution for you, unfortunately. I would recommend cloning the repository and fiddling about with the source code. Maybe there are some options in pyinstaller you can use? Also, as per the readme, there might be some more modules that must be added explicitly for import.

@SushantVarshney
Copy link
Author

@MartinSahlen Can you tell me which file is used to install any dependency on Cloud Function?

@SushantVarshney
Copy link
Author

SushantVarshney commented Jan 23, 2018

@MartinSahlen
Found some links to solve the above mentioned issues,but don't know how to use it inside your code

1) https://github.com/pyinstaller/pyinstaller/issues/3015
2) https://github.com/pyinstaller/pyinstaller/pull/2998/commits/017b247064f9bd51a620cfb2172c05d63fc75133

Can you do the above changes or tell me how to do changes?

@MartinSahlen
Copy link
Owner

Thanks, I should be able to get that into an update. I also have some other issues that seems mostly related to hidden imports - it seems that just updating pyinstaller version should fix this issue if the links you are referring to are correct.

@santhoshdc1590
Copy link

santhoshdc1590 commented Mar 29, 2018

@SushantVarshney I think this Hooks: Add hook-pandas.py to fix issue should help you resolve the issue

Just add '--hidden-import', 'pandas._libs.tslibs.timedeltas', inside cloud-functions-python/cloudfn/cli.py build function, then BUILD INSTALL the cloud-function-python

You should be able to solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants