admin管理员组

文章数量:1313156

I’m trying to import azure.kusto.ingest in my Python script, but I’m getting an ImportError stating that the module cannot be found.

I’ve already installed the required package using:

pip install azure-kusto-ingest

To confirm that the package is installed, I ran:

pip show azure-kusto-ingest

And it correctly displays the package details. However, when I try to import it I get the below error

I’m trying to import azure.kusto.ingest in my Python script, but I’m getting an ImportError stating that the module cannot be found.

I’ve already installed the required package using:

pip install azure-kusto-ingest

To confirm that the package is installed, I ran:

pip show azure-kusto-ingest

And it correctly displays the package details. However, when I try to import it I get the below error

Share Improve this question asked Jan 30 at 21:33 RobertRobert 1,2003 gold badges17 silver badges30 bronze badges 11
  • In that same environment, start a REPL instance and run the python codes import sys; sys.path Show us the output – dev_light Commented Jan 30 at 22:06
  • sys.path: ['/Volumes/macdev/foo/client-cocoa/scripts/olmbuild', '/Volumes/macdev/foo/client-cocoa/scripts/olmbuild/bin', '/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python311.zip', '/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11', '/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload', '/Volumes/macdev/foo/client-cocoa/venv/lib/python3.11/site-packages'] – Robert Commented Jan 31 at 0:37
  • can you try to install again by running python -m pip install azure-kusto-ingest? – dev_light Commented Jan 31 at 0:39
  • 1 Great that it worked for you. I can provide you an answer in detailed and it may also benefit for the community members. @Robert – Jahnavi Commented Feb 4 at 5:12
  • 1 Thanks! That would be greatly appreciated. – Robert Commented Feb 4 at 20:34
 |  Show 6 more comments

1 Answer 1

Reset to default 1

It correctly displays the package details. However, when I try to import it, I get the below error: -

Good that the issue got resolved from the comments. For benefit of the community, here I provided the detailed solution.

Though you installed a package in your environment to deal with Kusto python SDK libraries, it might be possible that the conflict occurs with imports or package installations.

Firstly, check the Python environment where the package is installed and also check if the versions are compatible. I would suggest you activate a virtual environment to execute python scripts and install their dependencies.

To do from the terminal, use below given commands.

py -m venv .venv
.venv\Scripts\activate

Once activated, now install azure-kusto-ingest package inside the virtual environment with below command.

pip install azure-kusto-ingest

Also check the interpreter path when you are running the script. Usually, visual studio code allows us to choose the Python interpreter path when you execute. Make sure that the relevant interpreter with latest version is selected, as there could be different interpreters may have different sets of installed modules.

After activating the virtual environment, also you can provide pip install -r requirements.txt command for successfully installing the modules present in requirements file.

You can also verify where pip installs the package with command python -m site. It provides you all the sys path details of python libraries as shown below.

As you already tried to show the package with pip show command, instead try python -m pip show azure-kusto-ingest to exactly show the package which makes sure that you are using the same Python environment without any conflict.

If none of the above resolves your issue, try uninstalling the existed Kusto package as well as pip and reinstall all the libraries to execute it without any fail.

本文标签: pythonUnable to import azurekustoingestStack Overflow