Orhun
Orhun

Reputation: 1252

How to add a Python package to Google Cloud Composer

I created a Composer environment and trying to add a Python package. When I try to add, after a while, it says "Failed to install PyPI packages". This documentation says, you should add some permissions to service account of Composer.

I added these roles to [PROJECT-ID][email protected] (Compute Engine default service account) but error still happening:

Which roles are necessary to add Python packages?

Upvotes: 1

Views: 3035

Answers (2)

Orhun
Orhun

Reputation: 1252

The problem was due to package version. I delimited the version value of the pymssql package like <3.0 and it didn't fail again.

Upvotes: 1

hexacyanide
hexacyanide

Reputation: 91599

The service account to initiate the update to a Cloud Composer environment is not the same as the service account held by the environment itself. That means the identity you are initiating the update with needs to have the update permission (composer.environments.update), but the environment itself needs permissions provided by roles/composer.worker.

Note that roles/composer.administrator is for managing environments, while roles/composer.worker is a machine role for compute instances. For this reason, the Composer Administrator roles doesn't inherit all the permissions that the Composer worker role has (because it has no use for them).

TL;DR: for the environment's service account, use roles/composer.worker instead of the administrator role.

Upvotes: 0

Related Questions