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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
nuskindlin
New Member

Error while running script

Hi, 

 

I was trying to run this text mining script (https://towardsdatascience.com/topic-modeling-in-power-bi-using-pycaret-54422b4e36d6). I tried installing matplotlib, numpy, pandas (via pip and conda) through the Anaconda prompt and each time I seem to get a different error based on how I install them. The current error I have is below:

 

DataSource.Error: ADO.NET: Python script error.
<pi>C:\Users\dlin\Anaconda3\envs\powerbi\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 "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\matplotlib\__init__.py", line 107, in <module>
from . import cbook, rcsetup
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\matplotlib\cbook\__init__.py", line 28, in <module>
import numpy as np
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import core
File "C:\Users\dlin\Anaconda3\envs\powerbi\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:

5 REPLIES 5
lucazav
New Member

Hi,

 

the short answer is that the solution is launching the Power BI Desktop executable from the Anaconda Prompt after activating the environment in which you want to run the Python script.

 

The long one is described in this blog post.

Syndicate_Admin
Administrator
Administrator

I think you have unsupported Python packages versions.

Please go to this link: https://docs.microsoft.com/en-us/power-bi/connect-data/service-python-packages-support

and install PowerBI supported Python packages versions.

I hope this helps 🙂

nuskindlin
New Member

Hey @v-alq-msft not sure if you had the chance to look at my comment above? Currently my Python script runs indefinitely in Power BI until it timed out even though there are only 300 rows of data. I had managed to run the script just fine on Jupyter Notebook within the same Anaconda environment. I had also referred to this post https://community.powerbi.com/t5/Desktop/Microsoft-PowerBI-Scripting-Python-Exceptions/m-p/850714 to add in the PATH environment variables but the issue still persists. Do you have any advice? Thank you~

v-alq-msft
Community Support
Community Support

Hi, @nuskindlin 

 

Based on the error message, it seems that the corresponding package failed to import. I'd like to suggest you refer to the following documents for further help. Do pay attention to the considerations and limitations.

 

Run Python scripts in Power BI Desktop 

Use Python in Query Editor 

Use an external Python IDE with Power BI 

Create Power BI visuals by using Python 

Create visuals by using Python packages in the Power BI service 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-alq-msft (Allan), Thanks for sending those links! It pointed me to the right direction and I managed to resolve the package issues through my Anaconda prompt. Currently there seems to be no more error when I am running my Python script in Power BI, but it loads indefinitely. Would you be able to help?

 

Screenshot 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors