简体   繁体   English

尝试在 Power BI 中运行 Python 脚本时出错

[英]Error when trying to run a Python script in Power BI

I keep getting the below error when trying to run python script in power BI.尝试在 Power BI 中运行 python 脚本时,我不断收到以下错误。 I have tried uninstalling and re-installing all numpy, pandas but to no avail.我尝试卸载并重新安装所有 numpy、pandas 但无济于事。

Please i would appreciate some assistance to get this running请我提供一些帮助以使其运行

DataSource.Error: ADO.NET: Python script error.
<pi>C:\Users\User\anaconda3\lib\site-packages\numpy\__init__.py:148: 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\User\PythonScriptWrapper_6bb79068-43bc-4932-896d-bb3c9e1e2a45\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(

I have tried uninstalling and re-installing all numpy, pandas but to no avail.我尝试卸载并重新安装所有 numpy、pandas 但无济于事。

Here you go, my man: This error message suggests that there is a problem with the installation of the numpy and pandas packages.给你 go,伙计:这个错误消息表明 numpy 和 pandas 包的安装有问题。 The warning message "mkl-service package failed to import" indicates that the Intel MKL library, which is used by numpy and pandas for improved performance, is not properly installed.警告消息“mkl-service package failed to import”表示未正确安装 numpy 和 pandas 用于提高性能的英特尔 MKL 库。

Solution 1: try is to install the mkl-service package, as suggested in the error message.解决方案一:尝试安装mkl-service package,如报错提示。 You can do this by running the command "pip install mkl-service" in your command prompt or terminal.您可以通过在命令提示符或终端中运行命令“pip install mkl-service”来执行此操作。

Solution 2: to try is to check that your python environment is using the correct version of numpy and pandas. You can check the version of the package by running "pip show numpy" or "pip show pandas" in your command prompt or terminal.解决方案 2:尝试检查您的 python 环境是否使用正确版本的 numpy 和 pandas。您可以通过在命令提示符或终端中运行“pip show numpy”或“pip show pandas”来检查 package 的版本。 Then you can try uninstalling the package and reinstalling the correct version that is compatible with your python environment.然后您可以尝试卸载 package 并重新安装与您的 python 环境兼容的正确版本。

Tip 1: You can also try to update your python version or using other python environment( eg: virtual environment) and check the compatibility of the package with the version of python you are using.提示1:您也可以尝试更新您的python版本或使用其他python环境(例如:虚拟环境)并检查package与您使用的python版本的兼容性。

Tip 2: Check that the python version you are using in Power BI is the same version of python you are installing the packages to.提示 2:检查您在 Power BI 中使用的 python 版本是否与您要将包安装到的 python 版本相同。

Since you are using the Anaconda Python distribution you are probably pretty aware that由于您使用的是 Anaconda Python 发行版,您可能很清楚

you have to ACTIVATE conda ,你必须激活 conda

before you can run PBIDesktop.exe.在运行 PBIDesktop.exe 之前。 This especially true if you want to include the C-libraries like the ones required for numpy.如果您想要包含 numpy 所需的 C 库,则尤其如此。

Simple as that.就那么简单。

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

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