Forum Discussion

sartaj123's avatar
sartaj123
New Member
1 year ago
Solved

Unable to import kusto packages in python notebook

Hi Team,

 

I am new to Fabric and Kusto Database. I was trying to read, and upadate the data from KQL database using Python Kusto libarary. I was referring the below documentations from fabric. I am getting error while installing the packages as well as while importing the packages as show below. Please help to resolve the issue. thank you in advance.

 

Query data using the Azure Data Explorer Python library - Azure Data Explorer | Microsoft Learn

 

command in notebook.

pip install azure-kusto-data
 
error/Log.
.....
...
 
Uninstalling azure-identity-1.15.0: Successfully uninstalled azure-identity-1.15.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. datasets 2.19.1 requires fsspec[http]<=2024.3.1,>=2023.1.0, but you have fsspec 2024.6.1 which is incompatible. fsspec-wrapper 0.1.14 requires PyJWT>=2.6.0, but you have pyjwt 2.4.0 which is incompatible. Successfully installed azure-core-2024.9.1 azure-identity-1.21.0 azure-kusto-data-5.0.1 ijson-3.3.0 msal-1.32.0 msal-extensions-1.3.1 requests-2.32.3
Note: you may need to restart the kernel to use updated packages.
 
import commands in notebook:
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
 
 
Error While importing packages in notebook.
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[8], line 1 ----> 1 from azure.kusto.data import KustoClient, KustoConnectionStringBuilder
2 from azure.kusto.data.exceptions import KustoServiceError
3 from azure.kusto.data.helpers import dataframe_from_result_table ModuleNotFoundError: No module named 'azure.kusto'
  • 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-data
    

           

          2. as dubugging suggests restart the Kernel, After installing, restart the notebook kernel. In Fabric: Click on "Kernel" → "Restart Kernel".

     

    1. 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 requests

     

    Once 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 --version

    Fabric 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

     

     

4 Replies

  • v-prasare's avatar
    v-prasare
    Community Support

    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-data
    

           

          2. as dubugging suggests restart the Kernel, After installing, restart the notebook kernel. In Fabric: Click on "Kernel" → "Restart Kernel".

     

    1. 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 requests

     

    Once 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 --version

    Fabric 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

     

     

  • v-prasare's avatar
    v-prasare
    Community Support

    sartaj123As 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

  • v-prasare's avatar
    v-prasare
    Community Support

    @sartaj123As 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

  • v-prasare's avatar
    v-prasare
    Community Support

    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