Python – Built-in libraries VS libraries installed in the “lib” folder

Built-in libraries VS libraries installed in the “lib” folder… here is a solution to the problem.

Built-in libraries VS libraries installed in the “lib” folder

I want to use firebase-admin on GAE.
So I installed firebase-admin as follows.

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')

Demand .txt

firebase-admin

And install it.

pip install -t lib -r requirements.txt

Then I looked at the “lib” folder and there are six.
The sixth version is 1.11.0.

But I’ve used the built-in six.

Apply.yaml

libraries:
- name: six
  version: latest

The built-in six versions are “1.9.0”.

Do these differences have an impact on the course of GAE?
If so, how can it be addressed?

Solution

Firebase-admin package six>=1.6.1 , so manually copying version 1.11.0 to your app won’t cause issues with the library.

However, you should ensure that code in your application that originally added six dependencies will work for this later, because the copied library will take precedence over any built-in libraries (so you don’t need to specify it in app.yaml either).

It’s worth mentioning that copied libraries count toward the file quota because the libraries are uploaded to App Engine along with your application code. If you’re concerned about reaching this quota, you can use this this technique to only install the dependencies that aren’t already built-in, which will reduce the overall file size.

Related Problems and Solutions