snowpark-python icon indicating copy to clipboard operation
snowpark-python copied to clipboard

SNOW-1648322: ML model registration doesn't work when the package name has dot in it

Open ganius opened this issue 1 year ago • 6 comments

We are trying to log a custom Machine Learning (ML) model to the Snowflake model registry using the log_model method https://docs.snowflake.com/en/developer-guide/snowpark-ml/reference/latest/api/registry/snowflake.ml.registry.Registry

The dependencies are autogluon.tabular and snowflake-ml-python Below is the code we ran to log the model

custom_model = snowml_registry.log_model(
    my_autogluon_model,
    model_name="autogluon_model_test",
    version_name="version_1",
    conda_dependencies=["autogluon.tabular>=1.0", "snowflake-ml-python"],
    options={"relax_version": False},
    signatures={"predict": predict_sign}, 
    comment='AutoGluon model PoC'
)

The method returns the following error

SnowparkSQLException: (1304): 01b6c2ae-0204-750c-0000-640503c32566: 391546 (XX000): SQL compilation error: Cannot create a Python function with the specified packages. Please check your packages specification and try again. 'Packages not found: - autogluon-tabular[version='>=1.0']'. Hint: These packages are available in other python runtimes:["snowflake-ml-python"->[3.8, 3.10, 3.11], "cloudpickle==2.2.1"->[3.8, 3.10, 3.11]].

The strange part in the error message is that the package that was not found is returned as autogluon-tabular (notice the dash in the name), whereas we pass the correct name of the package autogluon.tabular (with a dot in the name). We suspect that somewhere under the hood the dot in the name of the package is being replaced by a dash and conda is failing to find a package with that name and ultimately failing to log the model.

I found these issues that might be related and/or causing this issue https://github.com/pypa/pip/issues/3678 https://github.com/pypa/pip/issues/3666

Below are the answers to the generic template for bug reports

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    This happens in all supported versions of Python in Snowpark (3.8 to 3.11)

  2. What operating system and processor architecture are you using?

    We used a Snowpark Optimized Warehouse which are based on a Linux OS with x64 architecture, AFAIK.

  3. What are the component versions in the environment (pip freeze)?

    The package details are provided above

  4. What did you do?

    The steps we took are pretty much the same as in this quickstart, the only difference is that we use Autogluon instead of PyCaret to log a custom model. https://quickstarts.snowflake.com/guide/deploying_custom_models_to_snowflake_model_registry/index.html#3

  5. What did you expect to see?

    I expect the model to successfully register.

  6. Can you set logging to DEBUG and collect the logs? The debug level logs are attached. error.log

ganius avatar Sep 02 '24 12:09 ganius

Hello @ganius ,

Thanks for raising the issue; we are checking and will update you.

Regards, Sujan

sfc-gh-sghosh avatar Sep 03 '24 08:09 sfc-gh-sghosh

Hello @ganius ,

Yes, we are able to reproduce the issue, we are working on eliminating it.

Regards, Sujan

sfc-gh-sghosh avatar Sep 10 '24 10:09 sfc-gh-sghosh

Hello @ganius ,

The model you using its not supported natively, the preprocessing, autogluon does that which is not supported, so could you please create a custom model

The model registry only supports certain types of models: https://docs.snowflake.com/en/developer-guide/snowflake-ml/model-registry/overview https://docs.snowflake.com/en/developer-guide/snowflake-ml/model-registry/custom-models

Regards, Sujan

sfc-gh-sghosh avatar Sep 10 '24 15:09 sfc-gh-sghosh

Hello @ganius ,

We will work on fixing the issue from the Snowflake ML side tentatively in the next release.

Regards, Sujan

sfc-gh-sghosh avatar Sep 10 '24 17:09 sfc-gh-sghosh

Hello @ganius ,

We will work on fixing the issue from the Snowflake ML side tentatively in the next release.

Regards, Sujan

any update for this ? @sfc-gh-sghosh

adityapnusantara avatar Dec 30 '24 08:12 adityapnusantara

I'm experiencing this same issue trying to register a Pytorch model. The exact same notebook ran last week - using the GPU runtime that is exposed with SF Notebooks...

SnowparkSQLException: (1304): 391546 (XX000): None: SQL compilation error: Cannot create a Python function with the specified packages. Please check your packages specification and try again. 'One or more package conflicts were detected.'. Hint: These packages are available in other python runtimes:["cloudpickle<3,>=2.2"->[3.8, 3.9, 3.11, 3.12], "snowflake-ml-python<2,>=1.7"->[3.9, 3.11], "pytorch<3,>=2.5"->[3.9, 3.11, 3.12]].

AllardJM avatar Mar 10 '25 21:03 AllardJM