Azure / azure-kusto-python

Kusto client libraries for Python
MIT License
183 stars 109 forks source link

Encounter ModuleNotFoundError: No module named 'build' when import from azure.kusto.data in Azure Databricks #552

Closed kuangweil closed 3 days ago

kuangweil commented 3 days ago

Code Sample, a copy-pastable example if possible

from azure.kusto.data import KustoClient, KustoConnectionStringBuilder, ClientRequestProperties, DataFormat
from azure.kusto.data.exceptions import KustoServiceError

Problem description

We're using Azure Databricks to run our python notebook pipeline and it has been working until today. We encountered the following error message while trying to import Kusto client from azure.kusto.data. Our Databricks cluster would install the latest azure-kusto-data library every time it restarted. So, it's possible that the latest release caused this issue. See below error message.

" ModuleNotFoundError: No module named 'build' File , line 7 5 import openai 6 from transformers import GPT2TokenizerFast ----> 7 from azure.kusto.data import KustoClient, KustoConnectionStringBuilder, ClientRequestProperties, DataFormat 8 from azure.kusto.data.exceptions import KustoServiceError 9 from azure.kusto.data.helpers import dataframe_from_result_table File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.10/site-packages/azure/kusto/data/client.py:17 14 from azure.core.tracing import SpanKind 16 from azure.kusto.data._telemetry import Span, MonitoredActivity ---> 17 from build.lib.azure.kusto.data.exceptions import KustoServiceError 19 from .client_base import ExecuteRequestParams, _KustoClientBase 20 from .client_request_properties import ClientRequestProperties "

If query related, does it happen on other platforms (Kusto Web UI, Kusto Explorer)?

This is not query related. It's having trouble import the library.

Output of pip freeze

N/A

briantolley commented 3 days ago

In working through this with MSFT the following resolved it.... Had same issue starting at 8:30 EDT today.

The issue appears to be due to changes from the azure-kusto-data library as a new version (4.6.0) was released 9 hours ago on pypi. To work around this you can have the cx pin the version to the previous release, eg:

%pip install azure-kusto-data==4.5.1 dbutils.library.restartPython() from azure.kusto.data import KustoClient, KustoConnectionStringBuilder

AsafMah commented 3 days ago

4.6.0 has been yanked.

Will soon release a fixed 4.6.1.

AsafMah commented 3 days ago

Released 4.6.1, should fix the issue - let us know if that helped

kuangweil commented 2 days ago

Thank you for the response. We've selected the 4.5.1 release and that worked for us. Will consider moving to new releases.

briantolley commented 2 days ago

Tested the new 4.6.1 release with MSFT this morning and it is working without incident now. Just as an FYI.

kuangweil commented 2 days ago

Thank you, @briantolley and @AsafMah .