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
TiborTuboly
Frequent Visitor

Python script error - ImportError: DLL load failed: The specified module could not be found.

Hi,

 

I would like to run the following python script:

import pandas as pd

data=pd.read_table('https://raw.githubusercontent.com/petroGG/Basic-Well-Log-Interpretation/master/WA1.txt', delim_whitespace=True, index_col='M__DEPTH')

data=data.rename(columns=({'M__DEPTH':'DEPT'}))
data['DEPT']=data.index

 

But after I copy+paste it to Get Data->Python script, it gives the following error.

 

Details: "ADO.NET: Python script error.
Traceback (most recent call last):
  File "PythonScriptWrapper.PY", line 2, in <module>
    import os, pandas, matplotlib.pyplot
  File "C:\Users\tutsrr\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\pyplot.py", line 32, in <module>
    import matplotlib.colorbar
  File "C:\Users\tutsrr\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
    import matplotlib.contour as contour
  File "C:\Users\tutsrr\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\contour.py", line 18, in <module>
    import matplotlib.font_manager as font_manager
  File "C:\Users\tutsrr\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\font_manager.py", line 48, in <module>
    from matplotlib import afm, cbook, ft2font, rcParams, get_cachedir
ImportError: DLL load failed: The specified module could not be found.

 

Do you have any idea how to solve it? Python home directory is correctly set up in Power BI and my DLL files seems okay in my system folder.

Thanks.
Tibor

4 REPLIES 4
v-xicai
Community Support
Community Support

  

Hi @TiborTuboly ,

 

which version of Python your Anaconda environment is using? Try to create a new conda env with Python 3.5:

 

conda create -n py35 anaconda python=3.5

 

Then pip installing relevant packages:

 

conda activate py35

py -m pip install matplotlib

py -m pip install pandas

 

After finishing it, you need to point Power BI Desktop to the new env following steps :File -> Options and Settings -> Options -> Python Scripting. Then add the Path to your new Env, looks like: "C:\ProgramData\Anaconda3\envs\py35".

 

You can go through the links to learn more:   https://github.com/stan-dev/pystan/issues/520

https://stackoverflow.com/questions/53929599/cannot-import-aer-from-qiskit-0-7/54275759#54275759

https://github.com/Qiskit/qiskit-aer/issues/25

https://github.com/ContinuumIO/anaconda-issues/issues/10628

https://github.com/pytorch/pytorch/issues/9263

 

If you still have this issue for Power BI, you'd better create a support ticket in Power BI Support to get further help.

 

Best Regards,

Amy

 

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

 

 

This perfectly worked out for me. Thanks

Anonymous
Not applicable

I just want to say thank you for posting this, I have been trying to get this to work for like 3 days and this is the one thing that finally fixed it for me. 

Hi Amy,

unfortunately, I cannot create a new environment, my company laptop does not allow it.

I will try to install Python in my on my personal computer and I will try to run this code again.

I hope it solves the issue. I will get back with the results. 

Thank you.
Tibor

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.