stack_user
stack_user

Reputation: 595

Built-in Libraries VS Libraries installed in the "lib" folder

I want to use firebase-admin on GAE. So I installed firebase-admin following method.

https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27

appengine_config.py

from google.appengine.ext import vendor

# Add any libraries install in the "lib" folder.
vendor.add('lib')

requirements.txt

firebase-admin

and install it.

pip install -t lib -r requirements.txt

Then I checked in the "lib" folder, six is existed. And six version is 1.11.0.

But I've already use built-in six.

app.yaml

libraries:
- name: six
  version: latest

Built-in six version is "1.9.0".

Does these difference have any effect on the process of GAE? If there is any effect, How to solve this?

Upvotes: 3

Views: 308

Answers (2)

Dustin Ingram
Dustin Ingram

Reputation: 21570

The firebase-admin package requires six>=1.6.1, so manually copying in version 1.11.0 to your app won't cause problems with that library.

However, you should ensure that the code in your app that you originally added the six dependency for will work with this later version, as copied-in libraries will take precedence over any built-in libraries (thus specifying it in app.yaml is unnecessary as well).

It's worth mentioning that copied-in libraries count towards file quotas, because the library is uploaded to App Engine along with your application code. If you're concerned about hitting this quota, you can use this this technique to only install the dependencies that aren't already built-in, which will cut down on the overall file size.

Upvotes: 2

rilla
rilla

Reputation: 793

If there's a different version of a library in the lib directory and in the app.yaml, the one in the lib directory is the one which will be available to your app. So, effectively, your app will be using six 1.11.0. You can verify that by logging six.__version__ and see what version you get.

To avoid confusions, I would probably delete the six library entry in app.yaml.

Upvotes: 1

Related Questions