Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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

4 Replies

  • 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

    • Anonymous's avatar
      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

       

    • Juun_NV's avatar
      Juun_NV
      Regular Visitor

      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's avatar
    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