Skip to content

Importing predictor module fails on windows due to incorrect separator replacement #5679

@john-10alabs

Description

@john-10alabs

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: Windows 11
  • Python version: python --version: 3.11
  • pip version: pip --version: 25.1.1
  • google-cloud-aiplatform version: pip show google-cloud-aiplatform: 1.103.0

Steps to reproduce

  1. Use a custom Predictor in a module in a directory below the current directory publishing a local model
  2. Build a CPR model and deploy to a local endpoint

Code example

This line converts the path to the Predictor class to posix format, but then attempts to replace os-specific path separators with '.' to convert to an import. On windows, the path separator does not match posix format, thus the posix forward slash remains causing failed imports.

custom_class_import = custom_class_import_path.as_posix().replace(os.sep, ".")

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: vertex-aiIssues related to the googleapis/python-aiplatform API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions