简体   繁体   English

使用 Python 脚本从 Power BI 导入 AWS S3 上的 CSV 文件:导入 numpy C 扩展失败

[英]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.在 Power BI 中,我尝试导入存储在 AWS S3 存储桶中的 CSV 文件。 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.

</pi>"

Anyone any ideas?有人有什么想法吗? I already tried lots of things myself, like:我自己已经尝试了很多东西,例如:

  • installing a clean Anaconda virtual environment with the required libraries使用所需的库安装干净的 Anaconda 虚拟环境
  • remove/install numpy and setuptools as described here按照此处所述删除/安装 numpy 和 setuptools

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?会不会是python和numpy版本不兼容? 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)?如果是,我怎样才能找出我应该使用哪些兼容的版本(我尝试解决这个问题,但找不到任何信息)?

The NumPy version is: "1.20.1" NumPy 版本是:“1.20.1”

Currently the service supports NumPy 1.18.4 .目前该服务支持NumPy 1.18.4

Make sure all your modules, and version of python match the docs located here: https://docs.microsoft.com/en-us/power-bi/connect-data/service-python-packages-support确保您的所有模块和 python 版本与位于此处的文档匹配: https : //docs.microsoft.com/en-us/power-bi/connect-data/service-python-packages-support

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 Anaconda 不是与 Power BI 结合使用的好选择,因为您需要能够从命令提示符(我不能)打开 Power Bi,请参阅此操作
  • Instead of using Anaconda I installed Python 3.8.7 locally (64-bit version) and installed the required packages我没有使用 Anaconda,而是在本地安装了 Python 3.8.7(64 位版本)并安装了所需的软件包
  • To avoid any conflicts between Python versions I deleted all other local Python installations (I did not delete Anaconda's Python versions)为了避免 Python 版本之间的任何冲突,我删除了所有其他本地 Python 安装(我没有删除 Anaconda 的 Python 版本)
  • 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.然后我从开始菜单打开 Power BI,在 Power BI 选项和设置 - 数据加载(见图)中清除缓存,然后再次关闭 Power BI。
  • Then I opened Power BI again from the start menu and ran my Python script... it worked!然后我从开始菜单再次打开 Power BI 并运行我的 Python 脚本......它起作用了!

清除缓存 Power BI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM