Forum Discussion

gunjansa_ms's avatar
gunjansa_ms
Icon for Microsoft Employee rankMicrosoft Employee
6 years ago
Solved

Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException-Transforming data python

Facing error while trying to transform data in powerbi using python script. 

For initial script just tries to print string

print('done')

But this fails statin below error. Have installed Python version 3.7.4 with anaconda environment.

Have PowerBi Version: 2.75.5649.582 64-bit (November, 2019)

Have tried uninstalling and reinstalling pandas and matplotlib but no luck.

 

DataSource.Error: ADO.NET: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\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: DLL load failed: The specified module could not be found.

Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\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: DLL load failed: The specified module could not be found.

ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

  • gunjansa_ms's avatar
    gunjansa_ms
    6 years ago

    I was able to fix this. There is no issue with installation of libraries. 

    Bug is there in PowerBI. Even after providing the path of Python in settings, it expects environment variable PATH to be set with below paths.

    C:\Users\gunjansa\AppData\Local\Continuum\anaconda3

    C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin

    C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Scripts

    C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Library\bin

     

    Please get this fixed as this is an unnecessary additional step which took 3 days to debug the issue.

12 Replies

  • v-yuta-msft's avatar
    v-yuta-msft
    Icon for Community Support rankCommunity Support

    gunjansa_ms ,

     

    From the source code below, you may lost hard dependency modules, please check if you have installed: numpy, pytz, dateutil.

    # flake8: noqa
    
    __docformat__ = "restructuredtext"
    
    # Let users know if they're missing any of our hard dependencies
    hard_dependencies = ("numpy", "pytz", "dateutil")
    missing_dependencies = []
    
    for dependency in hard_dependencies:
        try:
            __import__(dependency)
        except ImportError as e:
            missing_dependencies.append("{0}: {1}".format(dependency, str(e)))
    
    if missing_dependencies:
        raise ImportError(
            "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
        )

     

    Community Support Team _ Jimmy Tao

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

    • gunjansa_ms's avatar
      gunjansa_ms
      Icon for Microsoft Employee rankMicrosoft Employee

      I was able to fix this. There is no issue with installation of libraries. 

      Bug is there in PowerBI. Even after providing the path of Python in settings, it expects environment variable PATH to be set with below paths.

      C:\Users\gunjansa\AppData\Local\Continuum\anaconda3

      C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin

      C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Scripts

      C:\Users\gunjansa\AppData\Local\Continuum\anaconda3\Library\bin

       

      Please get this fixed as this is an unnecessary additional step which took 3 days to debug the issue.

      • HeliosOne's avatar
        HeliosOne
        Frequent Visitor

        gunjansa_ms 

        Could you explain how actually you define PATH variable with paths in your message? I am facing same problem and my skill is not enough to fix this. A little guide would be great.

        Thank you!