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

SNOW-872425: Unable to add packages with version specifier when the package name contains underscore

Open sfc-gh-wzhao opened this issue 1 year ago • 1 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.8.13

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

    macOS-13.4.1-arm64-arm-64bit

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

    snowflake-snowpark-python==1.5.1

  4. What did you do?

    Create a session. Then run session.add_packages("huggingface_hub==0.15.1")

  5. What did you expect to see?

The package should be able to be added as it is available by checking information_schema.packages table.

What should have happened and what happened instead?

Instead, received

ValueError: Cannot add package huggingface_hub==0.15.1 because it is not available in Snowflake. Check information_schema.packages to see available packages for UDFs. If this package is a "pure-Python" package, you can find the directory of this package and add it via session.add_import(). See details at https://docs.snowflake.com/en/developer-guide/snowpark/python/creating-udfs.html#using-third-party-packages-from-anaconda-in-a-udf.
  1. Can you set logging to DEBUG and collect the logs?

I believe the issue lies here https://github.com/snowflakedb/snowpark-python/blob/edd7f29d10215eab8b3725d524551f1c164c3745/src/snowflake/snowpark/session.py#L904 When incoming package contains underscore, it takes the whole package specification as the package name, which incorrectly contains the version specification part.

sfc-gh-wzhao avatar Jul 20 '23 04:07 sfc-gh-wzhao

I can repro, assigned to myself since I need to clean up the deprecating dependencies on pkg_resources.

sfc-gh-stan avatar Oct 02 '23 16:10 sfc-gh-stan