Home > Mobile >  GAE/P3 dependency conflicts
GAE/P3 dependency conflicts

Time:01-01

I have a GAE standard Python 3 app. When I deploy with

gcloud app deploy app.yaml --project XXX

and this for my requirements.txt:

Werkzeug==1.0.1
Flask==1.1.2
Flask-Login==0.5.0
Flask-WTF==0.14.3
google-cloud-ndb==1.10.5
google-cloud-tasks==2.6.0
firebase-admin==5.0.3

I now get this error:

Updating service [default]...
WARNING: Found incompatible dependencies: 
google-cloud-datastore 1.15.3 has requirement google-api-core[grpc]<2.0.0dev,>=1.14.0, but you have google-api-core 2.1.1.
google-cloud-core 1.7.2 has requirement google-api-core<2.0.0dev,>=1.21.0, but you have google-api-core 2.1.1.
google-cloud-core 1.7.2 has requirement google-auth<2.0dev,>=1.24.0, but you have google-auth 2.3.0.

Although my app appears to be working, I'd like to get rid of these errors just in case.

I don't get these errors on my Mac, and nothing requires google-api-core 2.1.1.

The output of pipdeptree | fgrep api-core is:

  - google-api-core [required: >=1.22.1,<3.0.0dev, installed: 1.31.3]
    - google-api-core [required: >=1.21.0,<3.0.0dev, installed: 1.31.3]
    - google-api-core [required: >=1.26.0,<3.0.0dev, installed: 1.31.3]
      - google-api-core [required: >=1.21.0,<2.0.0dev, installed: 1.31.3]
    - google-api-core [required: >=1.29.0,<3.0dev, installed: 1.31.3]
      - google-api-core [required: >=1.21.0,<2.0.0dev, installed: 1.31.3]
    - google-api-core [required: >=1.14.0,<2.0.0dev, installed: 1.31.3]
      - google-api-core [required: >=1.21.0,<2.0.0dev, installed: 1.31.3]
  - google-api-core [required: >=1.26.0,<3.0.0dev, installed: 1.31.3]

My requirements.txt is shown below.

Is there a combination of versions of google-cloud-ndb, google-cloud-tasks, and firebase-admin that work together?

CodePudding user response:

When version numbers are not explicitly set in requirements.txt, the system will install the most recent version. And sometimes, the most recent version of one package is not compatible to another package.

In your project, google-api-core 2.1.1 is automatically installed but your version of google-cloud-datastore needs something lower than 2.0.0 but a minimum of 1.14.0. The same logic goes with the warnings related to google-cloud-core 1.7.2.

To fix this, you should explicitly set the version numbers for the mentioned packages using the version range provided in the warning message. You'll have to pick something that works for you. For example, you can have google-api-core 1.14.0 in your requirements.txt file but this assumes that there is nothing in your code that needs a feature that is in a higher release.

CodePudding user response:

Fixing the versions of google-api-core and google-auth gets rid of the version incompatibilities. It looks like there are a lot of changes with version 2 of these libraries (which are new as of a few months ago), and that firebase hasn't caught up yet so I fixed the most recent 1.* version.

Here is a working requirements.txt using latest libraries:

Werkzeug==1.0.1
Flask==1.1.2
Flask-Login==0.5.0
Flask-WTF==0.14.3
google-api-core==1.31.5   # Avoid conflicts
google-auth==1.35.0       # Avoid conflicts
google-cloud-ndb==1.11.1
google-cloud-tasks==2.7.1
firebase-admin==5.2.0

I wish pip could figure this stuff out...

  • Related