Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KosKoul
Helper I
Helper I

Error when importing data using Python script (Anaconda) in Power BI

Hi all, 

I tried to import data using python script on Power BI deskptop (last update was on 8 Dec 20) following the guidance provided here and received the following error message: 

Details: "ADO.NET: Python script error.
C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py:138: 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 <module>
import os, pandas, matplotlib
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
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:\ProgramData\Anaconda3\python.exe"
* The NumPy version is: "1.19.2"

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.

"

 
Before trying to run the script on PBI, I sucessfully instanlled the necessary packages (pandas and matplotlib) using Anaconda Prompt (Anaconda3), tested the script and worked, and applied all relevant settings to enable python scripting (File > Options and settings > Options > Python scripting where python home directory was correctly detected, and IDEs were on the Default OS program for .PY files). The versions I'm using is conda 4.9.2 and Python 3.8.5. 

Not sure if I missed something here as I am a beginner in python, however, any advice would be more than welcome. 

 

Thanks,
K

 



4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @KosKoul 

Did you install numpy?

The error message says it can't find it.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks Phil, 

Yes, I forgot to mention that numpy seems to be installed and the version is 1.19.2 as noted on the notification (that was checked on Anaconda Powershell Prompt):

 

Capture.PNG

 

That was tested as well before I tried to run the script in PBI. 

Thanks, 
K

Anonymous
Not applicable

Did you manage to find the solution to this problem? I am having the same issue.

 

Thanks,

AV

I think so.

WinPython solution with a minor edit.

Step by step procedure: 

  1. Download last version of Winpython from : https://winpython.github.io/
  2. Install Winpython on C: \
  3. In Power BI Desktop, select File > Options and settings > Options > Global > Python scripting. Set

    Python home directory as something like C:\WPy64-3770\python-3.7.7.amd64

  4. Optional: Restart Power BI

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.