Latest Enterprise DNA Initiatives


Error faced when importing data in PBI using Python script

HI EDNA team,

When I attempt to import data in PBI script, I face the following error:

Details: "ADO.NET: Python script error.
C:\Users\MusaFasih\anaconda3\lib\site-packages\numpy_init_.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
** from . import distributor_init**
Traceback (most recent call last):
** File “PythonScriptWrapper.PY”, line 2, in **
** import os, pandas, matplotlib**
** File "C:\Users\MusaFasih\anaconda3\lib\site-packages\pandas_init
.py", line 16, in **
** raise ImportError(**
ImportError: Unable to import required dependencies:
**numpy: **

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

** https://numpy.org/devdocs/user/troubleshooting-importerror.html**

Please note and check the following:

** * The Python version is: Python3.8 from “C:\Users\MusaFasih\anaconda3\python.exe”**
** * The NumPy version is: “1.20.1”**

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

"

I am fairly new to python so despite looking it up online, I am blank.

@musa.fasih Numpy isn’t installed on your system? Open Command Prompt and type pip install numpy

1 Like

hi @AntrikshSharma

When I typed pip install numpy in command prompt, the following appeared:

image

Go through this:

Even after installing numpy I face the same issue when using python script in power BI.

OK So this solved my problem:

In Power BI Desktop, I clicked File > Options & Settings> Options> Python Scripting>

Under ‘Detected Python home directories’, select 'Other.

Then, under ‘Set a python home directory’, insert the path with ‘new_env_pbi’ at the end of it.
In my case, the path is ‘C:\Users\MusaFasih\anaconda3\envs\new_env_pbi’ and it works fine.
Before making this change manually, the path showing was ‘C:\Users\MusaFasih\anaconda3’

@Keith Will do!

ty sir :slight_smile: