python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

[generative_ai]: extras packages not being installed

Open glasnt opened this issue 8 months ago • 1 comments

In which file did you encounter the issue?

https://github.com/GoogleCloudPlatform/python-docs-samples/pull/12865#issuecomment-2837128230

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/5d0f1faee810c30da6aea7a30848a3f402071065/generative_ai/model_tuning/requirements.txt#L6

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/5d0f1faee810c30da6aea7a30848a3f402071065/generative_ai/evaluation/requirements.txt#L6

Did you change the file? If so, how?

Updating to google-cloud-aiplatform version 1.90.0

Describe the issue

Testing returns import errors for sklearn

E   ModuleNotFoundError: No module named 'sklearn'

https://btx.cloud.google.com/invocations/77bb07ba-75b4-483e-a46a-12c548954f7c/log

glasnt avatar Apr 29 '25 01:04 glasnt

sklearn comes from scikit-learn, which is installed optionally when using google-cloud-aiplatform, specifically in google-cloud-aiplatform[evaluation] or google-cloud-aiplatform[testing].

It appears [all] is not a default extras specification (dependency specifiers, originally PEP-0508), and it is not explicitly defined in https://github.com/googleapis/python-aiplatform/blob/main/setup.py

google-cloud-aiplatform[all] is specified in a number of samples, but in theory is the same as just google-cloud-aiplatform.

Checking other extras options, [full] is possibly whats intended by [all], but this adds an additional ~74 packages and may not be appropriate for samples. evaluation may be the minimal change required.

The dependencies required by other samples should be confirmed and updated (in theory, would be the default no-extras if the samples work without extra dependencies)

glasnt avatar Apr 29 '25 01:04 glasnt