0

I've deployed my application on the Google App Engine python flexible runtime environment.
I thought to use a library (named as shap) which used to retrieve feature importance from the Random Forest model. I've mentioned its name in the requirement.txt while deploying to app engine. I also noticed that the installation of c extension(dependency of shap library) has mentioned in the setup file of shap library. Google Cloud App Engine (Flexible) is supposed to install this library with all dependencies including c extension, but when I run my application on the app engine, it starts getting following error:

name '_cext' is not defined.

here _cext is a c extension. This library is working fine locally. It seems it has a problem with the app engine flexible environment. Any help will be appreciated.

  • How is that extension normally installed? How did you install it on your local system? – Dan Cornilescu Nov 12 '18 at 14:22
  • C extension is a partial dependency of shap library. I'm getting the same error as you can see in the following link: – Ashish Balhara Nov 12 '18 at 15:41
  • sorry about unfinish comment. C extension is a partial dependency of shap library installation process, I'm getting the same error in google cloud, as it define in the following link: [https://github.com/slundberg/shap/issues/96](https://github.com/slundberg/shap/issues/96). The difference is in local it has been resolved. I don't even know whether google cloud can adapt third party library which is using C language file as an extension or not. – Ashish Balhara Nov 12 '18 at 15:53

1 Answers1

1

If the solution used locally relies exclusively on pip commands you may be able to use requirements.txt file options, see Requirements File Format.

But if you need something else besides executing pip operations then you probably have to build a custom runtime, see Up-to-date pip with AppEngine Python flex env?

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97