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 a...
  • v-prasare's avatar
    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-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