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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Error when trying to execute python script

Hi there, I'm getting error when executing python script.

 

Things I've tried from similar issue tickets from support. I've changed data source permissions. I've upgraded python via conda forge.

 

I run latest version of Power BI desktop and Anaconda as python environment

 

DataSource.Error: ADO.NET: Python script error.
C:\Users\user\Anaconda3\lib\site-packages\numpy\__init__.py:140: 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:\Users\user\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:\Users\user\Anaconda3\python.exe"
* The NumPy version is: "1.18.5"

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.


Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
C:\Users\gkereselidze\Anaconda3\lib\site-packages\numpy\__init__.py:140: 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:\Users\user\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 trouble...
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Unfortunately It was not worked. I was getting errors when trying to uninstal packages.

 

But, I found soulution here if anyone experiencing same issue  - https://medium.com/@pbabbott/how-to-connect-power-bi-and-python-on-windows-10-b131a36f4b44

 

So, the first thing you’ll want to do in this custom terminal is establish an environment with python 3.6 which can be done with this command:

conda create --name std_env python=3.6

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Please follow below steps, it might help you

 

  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 > Python scripting. The Python script options page appears.
  4. Specify the local Python installation path with the Winpython folder defined at step 2
  5. Restart Power BI
amitchandak
Super User
Super User

@Anonymous , As far I remember. I faced this. and conda install will not work. You need to use pip install even with the  anaconda.

 

uninstall first if needed

pip install --upgrade --force-reinstall numpy

pip install --upgrade --force-reinstall pandas

pip install --upgrade --force-reinstall matplotlib

pip install -c conda-forge mkl-service

conda activate

 

 

refer to my video and its description for related issues and command : https://www.youtube.com/watch?v=5D0BkNsu5CM

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hey!

Thank you so much for your answer. However, I believe the last line of code should rather be:

 

conda install -c conda-forge mkl-service 

 

pip install -c conda-forge mkl-service

gives an error message at least if you install it with Anaconda Prompt

Anonymous
Not applicable

Unfortunately It was not worked. I was getting errors when trying to uninstal packages.

 

But, I found soulution here if anyone experiencing same issue  - https://medium.com/@pbabbott/how-to-connect-power-bi-and-python-on-windows-10-b131a36f4b44

 

So, the first thing you’ll want to do in this custom terminal is establish an environment with python 3.6 which can be done with this command:

conda create --name std_env python=3.6

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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