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
PunchBird
Helper V
Helper V

Import CSV-file on AWS S3 from Power BI with Python script: Importing the numpy C-extensions failed

In Power BI, I am trying to import a CSV-file that's stored in an AWS S3 bucket with Get Data -> Python Script. I used the script I found here to import the data, but I keep getting this error. 

 

Details: "ADO.NET: Python script error. <pi>C:\Users\MyName\anaconda3\envs\PowerBI\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 <module>
    import os, pandas, matplotlib   File "C:\Users\MyName\anaconda3\envs\PowerBI\lib\site-packages\pandas\__init__.py", line 17, in <module>
    "Unable to import required dependencies:\n" + "\n".join(missing_dependencies) 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.7 from "C:\Users\MyName\anaconda3\envs\PowerBI\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: The specified module could not be found.

 

 

Does anyone have any ideas? I already tried lots of things myself, like:

  • installing a clean Anaconda virtual environment with the required libraries
  • remove/install numpy and setuptools as described here

Unfortunately nothing works, I keep getting the same error. Does anyone know what to do? Can it be that the Python and numpy version are not compatible? If yes, how can I find out what versions I should use that are compatible (I tried figuring this out but could not find any information)?

1 ACCEPTED SOLUTION
PunchBird
Helper V
Helper V

I did extensive research in the past few days and figured it out:

  • Anaconda is not a good option to use in combination with Power BI because you need to be able to open Power Bi from the command prompt (which I can't), see this acticle
  • Instead of using Anaconda I installed Python 3.8.7 locally (64-bit version) and installed the required packages
  • To avoid any conflicts between Python versions I deleted all other local Python installations (I did not delete Anaconda's Python versions)
  • Then I opened Power BI from the start menu, cleared the cache in Power BI options & settings - Data Load (see image) and then closed Power BI again.
  • Then I opened Power BI again from the start menu and ran my Python script... it worked!

clear cache PowerBI.png

View solution in original post

3 REPLIES 3
PunchBird
Helper V
Helper V

I did extensive research in the past few days and figured it out:

  • Anaconda is not a good option to use in combination with Power BI because you need to be able to open Power Bi from the command prompt (which I can't), see this acticle
  • Instead of using Anaconda I installed Python 3.8.7 locally (64-bit version) and installed the required packages
  • To avoid any conflicts between Python versions I deleted all other local Python installations (I did not delete Anaconda's Python versions)
  • Then I opened Power BI from the start menu, cleared the cache in Power BI options & settings - Data Load (see image) and then closed Power BI again.
  • Then I opened Power BI again from the start menu and ran my Python script... it worked!

clear cache PowerBI.png

v-rzhou-msft
Community Support
Community Support

Hi @PunchBird 

As the error code:

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

and then check if you have set it up.

https://docs.microsoft.com/en-us/power-bi/desktop-python-ide

 

Best Regards,
Rico Zhou

 

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

Hi @v-rzhou-msft , thanks for your suggestions. 

I am using Anaconda and have mkl-service installed, see:

# Name                    Version                   Build  Channel
asn1crypto                1.4.0              pyh9f0ad1d_0    conda-forge
awscli                    1.20.54          py36ha15d459_0    conda-forge
blas                      1.0                         mkl    anaconda
boto3                     1.18.21            pyhd3eb1b0_0
botocore                  1.21.54            pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py36h68aa20f_1001    conda-forge
ca-certificates           2021.9.30            haa95532_1
certifi                   2021.5.30        py36haa95532_0
cffi                      1.14.6           py36he58ceb7_1    conda-forge
colorama                  0.4.3                      py_0    conda-forge
cryptography              2.5              py36h74b6da3_1    conda-forge
cycler                    0.10.0           py36h009560c_0    anaconda
docutils                  0.15.2           py36ha15d459_2    conda-forge
freetype                  2.10.4               hd328e21_0    anaconda
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2             vc14hc45fdbb_0  [vc14]  anaconda
idna                      3.1                pyhd3deb0d_0    conda-forge
intel-openmp              2020.2                      254    anaconda
jmespath                  0.10.0             pyh9f0ad1d_0    conda-forge
jpeg                      9b               vc14h4d7706e_1  [vc14]  anaconda
kiwisolver                1.2.0            py36h74a9793_0    anaconda
libpng                    1.6.37               h2a8f88b_0    anaconda
matplotlib                3.2.1                         0    anaconda
matplotlib-base           3.2.1            py36h64f37c6_0    anaconda
mkl                       2019.4                      245    anaconda
mkl-service               2.3.0            py36hb782905_0    anaconda
mkl_fft                   1.2.0            py36h45dec08_0    anaconda
mkl_random                1.1.0            py36h675688f_0    anaconda
numpy                     1.18.1           py36h93ca92e_0
numpy-base                1.18.1           py36hc3f5095_1
openssl                   1.0.2u               he774522_0
pandas                    1.0.1            py36h47e9c7a_0    anaconda
pip                       21.0.1           py36haa95532_0
powershell_shortcut       0.0.1                         3
pyasn1                    0.4.8                      py_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pyopenssl                 19.0.0                   py36_0    conda-forge
pyparsing                 2.4.7                      py_0    anaconda
pyqt                      5.9.2            py36ha878b3d_0    anaconda
pysocks                   1.7.1            py36ha15d459_3    conda-forge
python                    3.6.13               h3758d61_0
python-dateutil           2.8.1                      py_0    anaconda
python_abi                3.6                     2_cp36m    conda-forge
pytz                      2020.1                     py_0    anaconda
pyyaml                    5.4.1            py36h68aa20f_1    conda-forge
qt                        5.9.6            vc14h1e9a669_2  [vc14]  anaconda
rsa                       4.7.2              pyh44b312d_0    conda-forge
s3transfer                0.5.0              pyhd8ed1ab_0    conda-forge
setuptools                58.0.4           py36haa95532_0
sip                       4.19.24          py36ha925a31_0    anaconda
six                       1.15.0                     py_0    anaconda
sqlite                    3.36.0               h2bbff1b_0
tornado                   6.0.4            py36he774522_1    anaconda
urllib3                   1.26.7             pyhd8ed1ab_0    conda-forge
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.0             pyhd3eb1b0_1
win_inet_pton             1.1.0            py36ha15d459_2    conda-forge
wincertstore              0.2              py36h7fe50ca_0
yaml                      0.2.5                he774522_0    conda-forge
zlib                      1.2.11           vc14h1cdd9ab_1  [vc14]  anaconda

 

I also have the Python home directory (C:\Users\MyName\anaconda3\envs\PowerBI) and Desktop Python IDE (I tried both "Default OS program for .PY files" and C:\Users\MyName\AppData\Local\Programs\Microsoft VS Code\Code.exe) set up, see:

PunchBird_0-1634561110647.png

... but I still get the same error. Do you have any other suggestions?

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.