Forum Discussion
Unable to import kusto packages in python notebook
- 1 year ago
Hi sartaj123,
Thanks for reaching MS Fabric comminty support.
Can you please try below debugging steps and let me know if this helps?
1. Install azure-kusto-data in a Fabric Notebook, Since Microsoft Fabric Notebooks run in a managed environment, you need to install packages using:
!pip install --upgrade azure-kusto-data If dependencies conflict, force reinstall: !pip install --upgrade --force-reinstall azure-kusto-data2. as dubugging suggests restart the Kernel, After installing, restart the notebook kernel. In Fabric: Click on "Kernel" → "Restart Kernel".
- Verify Package Installation, Run this in a separate cell to check if the package is available:
import importlib.util package_name = "azure.kusto.data" if importlib.util.find_spec(package_name) is None: print(f"Package {package_name} is not installed.") else: print(f"Package {package_name} is installed correctly.")If it's still missing, try installing dependencies manually and restart the kernel again.
!pip install --upgrade azure-identity requestsOnce installed, use:
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder from azure.kusto.data.exceptions import KustoServiceError from azure.kusto.data.helpers import dataframe_from_result_table import pandas as pd print("Kusto packages imported successfully!")4. If you still get ModuleNotFoundError, check: Fabric Notebook Python Version
!python --versionFabric runs Python 3.9+, so ensure compatibility. Check Installed Package
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query
sartaj123 As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?
Thanks,
Prashanth Are
MS Fabric community support
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query