Closed dhiegopiroto closed 1 year ago
Hi @dhiegopiroto! Did you create a new environment and follow the steps in the QS or did you install the packages individually? Can you also confirm your Python version. Thanks!
Hey, @iamontheinet . I've tried to use the quickstart script and tried to create the dependencies based on the environment.yml file. In both cases, I got the same error.
(snowpark-de-ml) dpiroto@ % python --version Python 3.9.17
Thanks for the reply :)
let me just to add all the exception message:
`--------------------------------------------------------------------------- SnowparkSQLException Traceback (most recent call last) /Users/dpiroto/src/github/sfguide-getting-started-dataengineering-ml-snowpark-python/Snowpark_For_Python_ML.ipynb Cell 17 line 3 1 test_df = session.create_dataframe([[250000,250000,200000,450000],[500000,500000,500000,500000],[8500,9500,2000,500]], 2 schema=['SEARCH_ENGINE','SOCIAL_MEDIA','VIDEO','EMAIL']) ----> 3 test_df.select( 4 'SEARCH_ENGINE','SOCIAL_MEDIA','VIDEO','EMAIL', 5 call_udf("predict_roi", 6 array_construct(col("SEARCH_ENGINE"), col("SOCIALMEDIA"), col("VIDEO"), col("EMAIL"))).as("PREDICTED_ROI")).show()
File ~/opt/anaconda3/envs/snowpark-de-ml/lib/python3.9/site-packages/snowflake/snowpark/_internal/telemetry.py:139, in df_collect_api_telemetry.
File ~/opt/anaconda3/envs/snowpark-de-ml/lib/python3.9/site-packages/snowflake/snowpark/dataframe.py:2855, in DataFrame.show(self, n, max_width, statement_params) 2836 @df_collect_api_telemetry 2837 def show( 2838 self, ... return _getattribute(sys.modules[module], name)[0] File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/pickle.py", line 331, in _getattribute raise AttributeError("Can't get attribute {!r} on {!r}" AttributeError: Can't get attribute '_passthrough_scorer' on <module 'sklearn.metrics._scorer' from '/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/site-packages/sklearn/metrics/_scorer.py'> in function PREDICT_ROI with handler compute`
and all conda libraries used:
abseil-cpp 20211102.0 he9d5cce_0 https://repo.anaconda.com/pkgs/snowflake absl-py 1.4.0 pypi_0 pypi aiobotocore 2.5.4 pypi_0 pypi aiohttp 3.8.5 pypi_0 pypi aioitertools 0.11.0 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi altair 5.1.1 pypi_0 pypi anyio 3.5.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake appdirs 1.4.4 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake appnope 0.1.2 py39hecd8cb5_1001 https://repo.anaconda.com/pkgs/snowflake argon2-cffi 21.3.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake argon2-cffi-bindings 21.2.0 py39hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake arrow-cpp 10.0.1 py39h7f74497_0 https://repo.anaconda.com/pkgs/snowflake asn1crypto 1.5.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake asttokens 2.0.5 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake async-timeout 4.0.3 pypi_0 pypi attrs 22.1.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake aws-c-common 0.4.57 hb1e8313_1 https://repo.anaconda.com/pkgs/snowflake aws-c-event-stream 0.1.6 h23ab428_5 https://repo.anaconda.com/pkgs/snowflake aws-checksums 0.1.9 hb1e8313_0 https://repo.anaconda.com/pkgs/snowflake aws-sdk-cpp 1.8.185 he271ece_0 https://repo.anaconda.com/pkgs/snowflake backcall 0.2.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake beautifulsoup4 4.12.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake blas 1.0 mkl https://repo.anaconda.com/pkgs/snowflake bleach 4.1.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake blinker 1.6.2 pypi_0 pypi boost-cpp 1.82.0 ha357a0b_1 https://repo.anaconda.com/pkgs/snowflake boto3 1.24.28 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake botocore 1.31.17 pypi_0 pypi bottleneck 1.3.5 py39h67323c0_0 https://repo.anaconda.com/pkgs/snowflake brotli 1.0.9 hca72f7f_7 https://repo.anaconda.com/pkgs/snowflake brotli-bin 1.0.9 hca72f7f_7 https://repo.anaconda.com/pkgs/snowflake brotlipy 0.7.0 py39h9ed2024_1003 https://repo.anaconda.com/pkgs/snowflake bzip2 1.0.8 h1de35cc_0 https://repo.anaconda.com/pkgs/snowflake c-ares 1.19.1 h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake ca-certificates 2023.08.22 hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake cachetools 4.2.2 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake certifi 2023.7.22 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake cffi 1.15.1 py39h6c40b1e_3 https://repo.anaconda.com/pkgs/snowflake charset-normalizer 2.0.4 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake click 8.1.7 pypi_0 pypi cloudpickle 2.0.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake comm 0.1.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake cryptography 41.0.2 py39h2093b18_0 https://repo.anaconda.com/pkgs/snowflake debugpy 1.6.7 py39hcec6c5f_0 https://repo.anaconda.com/pkgs/snowflake decorator 5.1.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake defusedxml 0.7.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake entrypoints 0.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake executing 0.8.3 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake filelock 3.9.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake frozenlist 1.4.0 pypi_0 pypi fsspec 2023.9.1 pypi_0 pypi gflags 2.2.2 h0a44026_0 https://repo.anaconda.com/pkgs/snowflake gitdb 4.0.10 pypi_0 pypi gitpython 3.1.36 pypi_0 pypi glog 0.5.0 h23ab428_0 https://repo.anaconda.com/pkgs/snowflake gmp 6.2.1 he9d5cce_3 https://repo.anaconda.com/pkgs/snowflake grpc-cpp 1.46.1 h64d96ca_1 https://repo.anaconda.com/pkgs/snowflake icu 73.1 hcec6c5f_0 https://repo.anaconda.com/pkgs/snowflake idna 3.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake importlib-metadata 6.8.0 pypi_0 pypi intel-openmp 2021.4.0 hecd8cb5_3538 https://repo.anaconda.com/pkgs/snowflake ipykernel 6.25.0 py39h20db666_0 https://repo.anaconda.com/pkgs/snowflake ipython 8.12.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake ipython_genutils 0.2.0 pyhd3eb1b0_1 https://repo.anaconda.com/pkgs/snowflake jedi 0.18.1 py39hecd8cb5_1 https://repo.anaconda.com/pkgs/snowflake jinja2 3.1.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jmespath 0.10.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake joblib 1.2.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jsonschema 4.17.3 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jupyter_client 7.4.9 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jupyter_core 5.3.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jupyter_server 1.23.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake jupyterlab_pygments 0.1.2 py_0 https://repo.anaconda.com/pkgs/snowflake krb5 1.20.1 hdba6334_1 https://repo.anaconda.com/pkgs/snowflake libboost 1.82.0 h74d5ea2_1 https://repo.anaconda.com/pkgs/snowflake libbrotlicommon 1.0.9 hca72f7f_7 https://repo.anaconda.com/pkgs/snowflake libbrotlidec 1.0.9 hca72f7f_7 https://repo.anaconda.com/pkgs/snowflake libbrotlienc 1.0.9 hca72f7f_7 https://repo.anaconda.com/pkgs/snowflake libcurl 8.2.1 ha585b31_0 https://repo.anaconda.com/pkgs/snowflake libcxx 14.0.6 h9765a3e_0 https://repo.anaconda.com/pkgs/snowflake libedit 3.1.20221030 h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake libev 4.33 h9ed2024_1 https://repo.anaconda.com/pkgs/snowflake libevent 2.1.12 h0a4fc7d_0 https://repo.anaconda.com/pkgs/snowflake libffi 3.4.4 hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake libgfortran 5.0.0 11_3_0_hecd8cb5_28 https://repo.anaconda.com/pkgs/snowflake libgfortran5 11.3.0 h9dfd629_28 https://repo.anaconda.com/pkgs/snowflake libiconv 1.16 hca72f7f_2 https://repo.anaconda.com/pkgs/snowflake libnghttp2 1.52.0 h1c88b7d_1 https://repo.anaconda.com/pkgs/snowflake libprotobuf 3.20.3 hfff2838_0 https://repo.anaconda.com/pkgs/snowflake libsodium 1.0.18 h1de35cc_0 https://repo.anaconda.com/pkgs/snowflake libssh2 1.10.0 hdb2fb19_2 https://repo.anaconda.com/pkgs/snowflake libthrift 0.15.0 h48f73ad_2 https://repo.anaconda.com/pkgs/snowflake libxml2 2.10.4 h1bd7e62_1 https://repo.anaconda.com/pkgs/snowflake libxslt 1.1.37 h6c40b1e_1 https://repo.anaconda.com/pkgs/snowflake llvm-openmp 14.0.6 h0dcd299_0 https://repo.anaconda.com/pkgs/snowflake lxml 4.9.2 py39h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake lz4-c 1.9.4 hcec6c5f_0 https://repo.anaconda.com/pkgs/snowflake markdown-it-py 3.0.0 pypi_0 pypi markupsafe 2.1.1 py39hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake matplotlib-inline 0.1.6 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake mdurl 0.1.2 pypi_0 pypi mistune 0.8.4 py39h9ed2024_1000 https://repo.anaconda.com/pkgs/snowflake mkl 2021.4.0 hecd8cb5_637 https://repo.anaconda.com/pkgs/snowflake mkl-service 2.4.0 py39h9ed2024_0 https://repo.anaconda.com/pkgs/snowflake mkl_fft 1.3.1 py39h4ab4a9b_0 https://repo.anaconda.com/pkgs/snowflake mkl_random 1.2.2 py39hb2f4e1b_0 https://repo.anaconda.com/pkgs/snowflake multidict 6.0.4 pypi_0 pypi nbclassic 0.5.5 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake nbclient 0.5.13 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake nbconvert 6.5.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake nbformat 5.7.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake ncurses 6.4 hcec6c5f_0 https://repo.anaconda.com/pkgs/snowflake nest-asyncio 1.5.6 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake notebook 6.5.4 py39hecd8cb5_1 https://repo.anaconda.com/pkgs/snowflake notebook-shim 0.2.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake numexpr 2.8.4 py39he696674_0 https://repo.anaconda.com/pkgs/snowflake numpy 1.24.3 py39he696674_0 https://repo.anaconda.com/pkgs/snowflake numpy-base 1.24.3 py39h9cd3388_0 https://repo.anaconda.com/pkgs/snowflake openssl 1.1.1w hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake orc 1.7.4 h995b336_1 https://repo.anaconda.com/pkgs/snowflake oscrypto 1.2.1 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake packaging 23.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pandas 1.5.3 py39h07fba90_0 https://repo.anaconda.com/pkgs/snowflake pandocfilters 1.5.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake parso 0.8.3 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake pexpect 4.8.0 pyhd3eb1b0_3 https://repo.anaconda.com/pkgs/snowflake pickleshare 0.7.5 pyhd3eb1b0_1003 https://repo.anaconda.com/pkgs/snowflake pillow 9.5.0 pypi_0 pypi pip 23.2.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake platformdirs 3.8.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pooch 1.4.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake prometheus_client 0.14.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake prompt-toolkit 3.0.36 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake protobuf 4.24.3 pypi_0 pypi psutil 5.9.0 py39hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake ptyprocess 0.7.0 pyhd3eb1b0_2 https://repo.anaconda.com/pkgs/snowflake pure_eval 0.2.2 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake pyarrow 10.0.1 py39h7122ad0_0 https://repo.anaconda.com/pkgs/snowflake pycparser 2.21 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake pycryptodomex 3.15.0 py39hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake pydeck 0.8.1b0 pypi_0 pypi pygments 2.15.1 py39hecd8cb5_1 https://repo.anaconda.com/pkgs/snowflake pyjwt 2.4.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pympler 1.0.1 pypi_0 pypi pyopenssl 23.2.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pyrsistent 0.18.0 py39hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake pysocks 1.7.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake python 3.9.17 h218abb5_0 https://repo.anaconda.com/pkgs/snowflake python-dateutil 2.8.3a1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake python-fastjsonschema 2.16.2 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pytz 2022.7 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake pytz-deprecation-shim 0.1.0.post0 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi pyzmq 23.2.0 py39he9d5cce_0 https://repo.anaconda.com/pkgs/snowflake re2 2022.04.01 he9d5cce_0 https://repo.anaconda.com/pkgs/snowflake readline 8.2 hca72f7f_0 https://repo.anaconda.com/pkgs/snowflake requests 2.31.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake rich 13.5.3 pypi_0 pypi s3fs 2023.9.1 pypi_0 pypi s3transfer 0.6.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake scikit-learn 1.2.2 py39hcec6c5f_1 https://repo.anaconda.com/pkgs/snowflake scipy 1.10.0 py39h91c6ef4_1 https://repo.anaconda.com/pkgs/snowflake send2trash 1.8.0 pyhd3eb1b0_1 https://repo.anaconda.com/pkgs/snowflake setuptools 68.0.0 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake six 1.16.0 pyhd3eb1b0_1 https://repo.anaconda.com/pkgs/snowflake smmap 5.0.1 pypi_0 pypi snappy 1.1.9 he9d5cce_0 https://repo.anaconda.com/pkgs/snowflake sniffio 1.2.0 py39hecd8cb5_1 https://repo.anaconda.com/pkgs/snowflake snowflake-connector-python 3.1.0 py39h3ea8b11_0 https://repo.anaconda.com/pkgs/snowflake snowflake-ml-python 1.0.8 pypi_0 pypi snowflake-snowpark-python 1.7.0 pypi_0 pypi sortedcontainers 2.4.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake soupsieve 2.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake sqlite 3.41.2 h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake sqlparse 0.4.4 pypi_0 pypi stack_data 0.2.0 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake streamlit 1.23.1 pypi_0 pypi tenacity 8.2.3 pypi_0 pypi terminado 0.17.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake threadpoolctl 2.2.0 pyh0d69192_0 https://repo.anaconda.com/pkgs/snowflake tinycss2 1.2.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake tk 8.6.12 h5d9f67b_0 https://repo.anaconda.com/pkgs/snowflake toml 0.10.2 pypi_0 pypi tomlkit 0.11.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake toolz 0.12.0 pypi_0 pypi tornado 6.3.2 py39h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake traitlets 5.7.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake typing-extensions 4.7.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake typing_extensions 4.7.1 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake tzdata 2023.3 pypi_0 pypi tzlocal 4.3.1 pypi_0 pypi urllib3 1.26.16 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake utf8proc 2.6.1 h9ed2024_0 https://repo.anaconda.com/pkgs/snowflake validators 0.22.0 pypi_0 pypi wcwidth 0.2.5 pyhd3eb1b0_0 https://repo.anaconda.com/pkgs/snowflake webencodings 0.5.1 py39hecd8cb5_1 https://repo.anaconda.com/pkgs/snowflake websocket-client 0.58.0 py39hecd8cb5_4 https://repo.anaconda.com/pkgs/snowflake wheel 0.38.4 py39hecd8cb5_0 https://repo.anaconda.com/pkgs/snowflake wrapt 1.15.0 pypi_0 pypi xgboost 1.7.6 pypi_0 pypi xz 5.4.2 h6c40b1e_0 https://repo.anaconda.com/pkgs/snowflake yarl 1.9.2 pypi_0 pypi zeromq 4.3.4 h23ab428_0 https://repo.anaconda.com/pkgs/snowflake zipp 3.17.0 pypi_0 pypi zlib 1.2.13 h4dc903c_0 https://repo.anaconda.com/pkgs/snowflake zstd 1.5.5 hc035e20_0 https://repo.anaconda.com/pkgs/snowflake
Hi, Also stuck at the same step. Error message below:
SnowparkSQLException Traceback (most recent call last) Cell In[13], line 1 ----> 1 test_df.select( 2 'SEARCH_ENGINE','SOCIAL_MEDIA','VIDEO','EMAIL', 3 call_udf("predict_roi", 4 array_construct(col("SEARCH_ENGINE"), col("SOCIALMEDIA"), col("VIDEO"), col("EMAIL"))).as("PREDICTED_ROI")).show()
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\telemetry.py:139, in df_collect_api_telemetry.
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark\dataframe.py:2811, in DataFrame.show(self, n, max_width, statement_params)
2792 @df_collect_api_telemetry
2793 def show(
2794 self,
(...)
2798 statement_params: Optional[Dict[str, str]] = None,
2799 ) -> None:
2800 """Evaluates this DataFrame and prints out the first n
rows with the
2801 specified maximum number of characters per column.
2802
(...)
2808 statement_params: Dictionary of statement level parameters to be set while executing this action.
2809 """
2810 print(
-> 2811 self._show_string(
2812 n,
2813 max_width,
2814 _statement_params=create_or_update_statement_params_with_query_tag(
2815 statement_params or self._statement_params,
2816 self._session.query_tag,
2817 SKIP_LEVELS_TWO,
2818 ),
2819 )
2820 )
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark\dataframe.py:2929, in DataFrame._show_string(self, n, max_width, kwargs) 2926 query = self._plan.queries[-1].sql.strip().lower() 2928 if is_sql_select_statement(query): -> 2929 result, meta = self._session._conn.get_result_and_metadata( 2930 self.limit(n)._plan, kwargs 2931 ) 2932 else: 2933 res, meta = self._session._conn.get_result_and_metadata( 2934 self._plan, **kwargs 2935 )
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:586, in ServerConnection.get_result_and_metadata(self, plan, kwargs) 583 def get_result_and_metadata( 584 self, plan: SnowflakePlan, kwargs 585 ) -> Tuple[List[Row], List[Attribute]]: --> 586 result_set, result_meta = self.get_result_set(plan, **kwargs) 587 result = result_set_to_rows(result_set["data"]) 588 meta = convert_result_meta_to_attribute(result_meta)
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\analyzer\snowflake_plan.py:181, in SnowflakePlan.Decorator.wrap_exception.
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\analyzer\snowflake_plan.py:111, in SnowflakePlan.Decorator.wrap_exception.
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:546, in ServerConnection.get_result_set(self, plan, to_pandas, to_iter, block, data_type, log_on_exception, casesensitive, **kwargs) 544 for holder, id in placeholders.items(): 545 final_query = finalquery.replace(holder, id) --> 546 result = self.run_query( 547 final_query, 548 to_pandas, 549 to_iter and (i == len(plan.queries) - 1), 550 is_ddl_on_temp_object=query.is_ddl_on_temp_object, 551 block=not is_last, 552 data_type=data_type, 553 async_job_plan=plan, 554 log_on_exception=log_on_exception, 555 case_sensitive=case_sensitive, 556 params=query.params, 557 **kwargs, 558 ) 559 placeholders[query.query_id_place_holder] = ( 560 result["sfqid"] if not is_last else result.query_id 561 ) 562 result_meta = self._cursor.description
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:102, in ServerConnection._Decorator.wrap_exception.
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:96, in ServerConnection._Decorator.wrap_exception.
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:366, in ServerConnection.run_query(self, query, to_pandas, to_iter, is_ddl_on_temp_object, block, data_type, async_job_plan, log_on_exception, case_sensitive, params, num_statements, **kwargs) 364 query_id_log = f" [queryID: {ex.sfqid}]" if hasattr(ex, "sfqid") else "" 365 logger.error(f"Failed to execute query{query_id_log} {query}\n{ex}") --> 366 raise ex 368 # fetch_pandas_all/batches() only works for SELECT statements 369 # We call fetchall() if fetch_pandas_all/batches() fails, 370 # because when the query plan has multiple queries, it will 371 # have non-select statements, and it shouldn't fail if the user 372 # calls to_pandas() to execute the query. 373 if block:
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\snowpark_internal\server_connection.py:347, in ServerConnection.run_query(self, query, to_pandas, to_iter, is_ddl_on_temp_object, block, data_type, async_job_plan, log_on_exception, case_sensitive, params, num_statements, kwargs) 345 kwargs["_statement_params"]["SNOWPARK_SKIP_TXN_COMMIT_IN_DDL"] = True 346 if block: --> 347 results_cursor = self._cursor.execute(query, params=params, kwargs) 348 self.notify_query_listeners( 349 QueryRecord(results_cursor.sfqid, results_cursor.query) 350 ) 351 logger.debug(f"Execute query [queryID: {results_cursor.sfqid}] {query}")
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\connector\cursor.py:908, in SnowflakeCursor.execute(self, command, params, _bind_stage, timeout, _exec_async, _no_retry, _do_reset, _put_callback, _put_azure_callback, _put_callback_output_stream, _get_callback, _get_azure_callback, _get_callback_output_stream, _show_progress_bar, _statement_params, _is_internal, _describe_only, _no_results, _is_put_get, _raise_put_get_error, _force_put_overwrite, _skip_upload_on_content_match, file_stream, num_statements) 904 is_integrity_error = ( 905 code == "100072" 906 ) # NULL result in a non-nullable column 907 error_class = IntegrityError if is_integrity_error else ProgrammingError --> 908 Error.errorhandler_wrapper(self.connection, self, error_class, errvalue) 909 return self
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\connector\errors.py:290, in Error.errorhandler_wrapper(connection, cursor, error_class, error_value) 267 @staticmethod 268 def errorhandler_wrapper( 269 connection: SnowflakeConnection | None, (...) 272 error_value: dict[str, Any], 273 ) -> None: 274 """Error handler wrapper that calls the errorhandler method. 275 276 Args: (...) 287 exception to the first handler in that order. 288 """ --> 290 handed_over = Error.hand_to_other_handler( 291 connection, 292 cursor, 293 error_class, 294 error_value, 295 ) 296 if not handed_over: 297 raise Error.errorhandler_make_exception( 298 error_class, 299 error_value, 300 )
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\connector\errors.py:345, in Error.hand_to_other_handler(connection, cursor, error_class, error_value) 343 if cursor is not None: 344 cursor.messages.append((error_class, error_value)) --> 345 cursor.errorhandler(connection, cursor, error_class, error_value) 346 return True 347 elif connection is not None:
File ~\AppData\Local\miniconda3\envs\snowpark-de-ml\lib\site-packages\snowflake\connector\errors.py:221, in Error.default_errorhandler(connection, cursor, error_class, error_value) 219 errno = error_value.get("errno") 220 done_format_msg = error_value.get("done_format_msg") --> 221 raise error_class( 222 msg=error_value.get("msg"), 223 errno=None if errno is None else int(errno), 224 sqlstate=error_value.get("sqlstate"), 225 sfqid=error_value.get("sfqid"), 226 query=error_value.get("query"), 227 done_format_msg=( 228 None if done_format_msg is None else bool(done_format_msg) 229 ), 230 connection=connection, 231 cursor=cursor, 232 )
SnowparkSQLException: (1304): 01af1869-0001-c222-0000-003a7b0759c1: 100357 (P0000): Python Interpreter Error: Traceback (most recent call last): File "_udf_code.py", line 51, in compute File "_udf_code.py", line 40, in wrapper File "C:\Users\aekhoury\AppData\Local\Temp\ipykernel_24052\1935627540.py", line 12, in predict_roi File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 658, in load obj = _unpickle(fobj, filename, mmap_mode) File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 577, in _unpickle obj = unpickler.load() File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/pickle.py", line 1212, in load dispatchkey[0] File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/pickle.py", line 1537, in load_stack_global self.append(self.find_class(module, name)) File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/pickle.py", line 1581, in find_class return _getattribute(sys.modules[module], name)[0] File "/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/pickle.py", line 331, in _getattribute raise AttributeError("Can't get attribute {!r} on {!r}" AttributeError: Can't get attribute '_passthrough_scorer' on <module 'sklearn.metrics._scorer' from '/usr/lib/python_udf/cc189aaa19e7dc666cf02176e2f22eea863747958e19ccd50dfa7f40bf5684dd/lib/python3.9/site-packages/sklearn/metrics/_scorer.py'> in function PREDICT_ROI with handler compute
Hi @dhiegopiroto and @aelkhoury79!
I have pushed a fix. Can you please try it from scratch and see if it works for you both?
Thank you! Dash
did not work for me, @iamontheinet
What I did (suggestion of Haowei) is modify both inference scripts to use sklearn version dynamically, since the module is saved using a new version and the guide is trying to use an old one.
Scalar UDF:
session.add_packages('pandas','joblib',f'scikit-learn=={sklearn.__version__}')
Vectorized UDF
session.add_packages('pandas','joblib','cachetools',f'scikit-learn=={sklearn.__version__}')
and then add into the imports the library
import sklearn
Worked for me :)
Hi @iamontheinet your fix seems to have worked for me after I deleted my conda env and starting over. Thanks a lot!
Thanks for confirming @aelkhoury79!
@sfc-gh-dpiroto Did you pull the latest before retrying? See my commit from yesterday https://github.com/Snowflake-Labs/sfguide-getting-started-dataengineering-ml-snowpark-python/commit/57331d8ba33468705bc9117c30875f0ce8e6dd48
Closing this issue. Let me know if you run into anything else. Thanks!
Hi, When I tried to run the call for the UDF for inference with new data, I got this error message:
code execution
python
Error returned
relevant libraries and versions: snowflake-snowpark-python 1.7.0 snowflake-ml-python 1.0.8 scikit-learn 1.2.2