msticpy/nbtools/azure_ml_tools.py
def _check_kql_prereqs():
    """
    Check and install packages for Kqlmagic/msal_extensions.

    Notes
    -----
    Kqlmagic may trigger warnings about a missing PyGObject package
    and some system library dependencies. To fix this do the
    following:<br>
    From a notebook run:

        %pip uninstall enum34
        !sudo apt-get --yes install libgirepository1.0-dev
        !sudo apt-get --yes install gir1.2-secret-1
        %pip install pygobject

    You can also do this from a terminal - but ensure that you've
    activated the environment corresponding to the kernel you are
    using prior to running the pip commands.

        # Install the libgi dependency
        sudo apt install libgirepository1.0-dev
        sudo apt install gir1.2-secret-1

        # activate the environment
        # conda activate azureml_py38
        # source ./env_path/scripts/activate

        # Uninstall enum34
        python -m pip uninstall enum34
        # Install pygobject
        python -m install pygobject

    """
    if not is_in_aml():
        return
    try:
        # If this successfully imports, we are ok
        # pylint: disable=import-outside-toplevel
        import gi

        # pylint: enable=import-outside-toplevel
        del gi
    except ImportError:
        # Check for system packages
        ip_shell = get_ipython()
        if not ip_shell:
            return
        apt_list = ip_shell.run_line_magic("sx", "apt list")
        apt_list = [apt.split("/", maxsplit=1)[0] for apt in apt_list]
        missing_lx_pkg = [
            apt_pkg
            for apt_pkg in ("libgirepository1.0-dev", "gir1.2-secret-1")
            if apt_pkg not in apt_list
        ]
        if missing_lx_pkg:
            _disp_html(
                "Kqlmagic/msal-extensions pre-requisite PyGObject not installed."
            )
            _disp_html(
                "To prevent warnings when loading the Kqlmagic data provider,"
                " Please run the following commands:<br>"
                f"<pre>!sudo apt-get --yes install {' '.join(missing_lx_pkg)}</pre><br>"
                "<pre>!pip uninstall -y enum34</pre><br>"
                "<pre>!pip install PyGObject</pre>"
            )

    Check and install packages for Kqlmagic/msal_extensions.

    Notes
    -----
    Kqlmagic may trigger warnings about a missing PyGObject package
    and some system library dependencies. To fix this do the
    following:<br>
    From a notebook run:

        %pip uninstall enum34
        !sudo apt-get --yes install libgirepository1.0-dev
        !sudo apt-get --yes install gir1.2-secret-1
        %pip install pygobject

    You can also do this from a terminal - but ensure that you've
    activated the environment corresponding to the kernel you are
    using prior to running the pip commands.

        # Install the libgi dependency
        sudo apt install libgirepository1.0-dev
        sudo apt install gir1.2-secret-1

        # activate the environment
        # conda activate azureml_py38
        # source ./env_path/scripts/activate

        # Uninstall enum34
        python -m pip uninstall enum34
        # Install pygobject
        python -m install pygobject

    
Check and install packages for Kqlmagic/msal_extensions.
Notes

Kqlmagic may trigger warnings about a missing PyGObject package
and some system library dependencies. To fix this do the
following:
From a notebook run.



You can also do this from a terminal - but ensure that you've
activated the environment corresponding to the kernel you are
using prior to running the pip commands.

Install the libgi dependency
sudo apt install libgirepository1.0-dev
sudo apt install gir1.2-secret-1



Uninstall enum34
python -m pip uninstall enum34
Install pygobject
python -m install pygobject
Check and install packages for Kqlmagic / msal_extensions . Notes Kqlmagic may trigger warnings about a missing PyGObject package and some system library dependencies . To fix this do the following : From a notebook run . You can also do this from a terminal - but ensure that you ' ve activated the environment corresponding to the kernel you are using prior to running the pip commands . Install the libgi dependency sudo apt install libgirepository1 . 0 - dev sudo apt install gir1 . 2 - secret - 1 Uninstall enum34 python - m pip uninstall enum34 Install pygobject python - m install pygobject
def _check_kql_prereqs():
    if not is_in_aml():
        return
    try:
        import gi
        del gi
    except ImportError:
        ip_shell = get_ipython()
        if not ip_shell:
            return
        apt_list = ip_shell.run_line_magic("sx", "apt list")
        apt_list = [apt.split("/", maxsplit=1)[0] for apt in apt_list]
        missing_lx_pkg = [
            apt_pkg
            for apt_pkg in ("libgirepository1.0-dev", "gir1.2-secret-1")
            if apt_pkg not in apt_list
        ]
        if missing_lx_pkg:
            _disp_html(
                "Kqlmagic/msal-extensions pre-requisite PyGObject not installed."
            )
            _disp_html(
                "To prevent warnings when loading the Kqlmagic data provider,"
                " Please run the following commands:<br>"
                f"<pre>!sudo apt-get --yes install {' '.join(missing_lx_pkg)}</pre><br>"
                "<pre>!pip uninstall -y enum34</pre><br>"
                "<pre>!pip install PyGObject</pre>"
            )
def _check_kql_prereqs ( ) : if not is_in_aml ( ) : return try : import gi del gi except ImportError : ip_shell = get_ipython ( ) if not ip_shell : return apt_list = ip_shell . run_line_magic ( "sx" , "apt list" ) apt_list = [ apt . split ( "/" , maxsplit = 1 ) [ 0 ] for apt in apt_list ] missing_lx_pkg = [ apt_pkg for apt_pkg in ( "libgirepository1.0-dev" , "gir1.2-secret-1" ) if apt_pkg not in apt_list ] if missing_lx_pkg : _disp_html ( "Kqlmagic/msal-extensions pre-requisite PyGObject not installed." ) _disp_html ( "To prevent warnings when loading the Kqlmagic data provider," " Please run the following commands:<br>" f"<pre>!sudo apt-get --yes install {' '.join(missing_lx_pkg)}</pre><br>" "<pre>!pip uninstall -y enum34</pre><br>" "<pre>!pip install PyGObject</pre>" )
Check and install packages for Kqlmagic/msal_extensions.
Check and install packages for Kqlmagic / msal_extensions .
"""
    Check and install packages for Kqlmagic/msal_extensions.

    Notes
    -----
    Kqlmagic may trigger warnings about a missing PyGObject package
    and some system library dependencies. To fix this do the
    following:<br>
    From a notebook run:

        %pip uninstall enum34
        !sudo apt-get --yes install libgirepository1.0-dev
        !sudo apt-get --yes install gir1.2-secret-1
        %pip install pygobject

    You can also do this from a terminal - but ensure that you've
    activated the environment corresponding to the kernel you are
    using prior to running the pip commands.

        # Install the libgi dependency
        sudo apt install libgirepository1.0-dev
        sudo apt install gir1.2-secret-1

        # activate the environment
        # conda activate azureml_py38
        # source ./env_path/scripts/activate

        # Uninstall enum34
        python -m pip uninstall enum34
        # Install pygobject
        python -m install pygobject

    """ # If this successfully imports, we are ok # pylint: disable=import-outside-toplevel # pylint: enable=import-outside-toplevel # Check for system packages