The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Solved! Go to Solution.
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.
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.
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.
I had already added these in environment variable PATH, I had another extra step was to start Power BI go to --> File --> Options and Settings --> Options --> Python scripting --> Change Detected Python IDEs: "Other" and select "C:\Users\<username>\Anaconda3\Scripts\conda.exe" ****Note: this path depends on where you installed conda.exe --> OK.
Restart Power BI and then any script works.
Thanks
Thanks a lot, with this final step I fixed the issue.
How to set this environment varaibles can you send me screenshot
Can you guys provide specifically what had to be done here?
I spent a whole work day trying to debug/fix this issue. After a whole lot of reading posts on google, stack overflow and countless iteration of updating anaconda, uninstall/reinstall numpy, I stumbled across this post. Thanks @gunjansa_ms for the workaround. Cannot believe it was as easy as adding a few environemntal variables. Hopefully the PowerBI team fixes this soon or update their documentation to set the path variable.
providing that the variable path needto be add ...it is not enough explanation.
This how: https://www.h3xed.com/windows/how-to-add-to-and-edit-windows-path-variable
looks this @HeliosOne link https://community.powerbi.com/t5/Desktop/error-Working-Directory-does-not-exit/td-p/676990
if you add them in the Path .. It start the python to work from Anaconda
Thank you Sir @gunjansa_ms! I solved it by adding anaconda3\Scripts and anaconda3\Library\bin to PATH variable.
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!
Go to Properties of your PC.
Go to Change settings
Go to Environment Variables
Go to Path in System Variables. Add 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
Thank you guys for that explanation. You are real Python ninjas! 🙂
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
78 | |
66 | |
52 | |
50 |
User | Count |
---|---|
121 | |
118 | |
77 | |
64 | |
63 |