cancel
Showing results for 
Search instead for 
Did you mean: 

PowerBI Python can not import libs - Python script error

I try to make some graphics with python seaborn.
The code works fine in jupyter (Anacoda) Python 3.7 and also in Databricks.

 

Seems that PowerBI Dektop can not find the libaries, but the path is set correct in PowerBI options:

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

 

This is the script generated by PowerBI
and below the error message

 

# Prolog - Auto Generated #
import os, uuid, matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot
import pandas

os.chdir(u'C:/Users/okumhofer/PythonEditorWrapper_a97a1d23-6e1f-4284-862a-d910dc6c8745')
dataset = pandas.read_csv('input_df_13f6f673-eb1c-4458-9103-6f0e3372a765.csv')

matplotlib.pyplot.figure(figsize=(5.55555555555556,4.16666666666667))
matplotlib.pyplot.show = lambda args=None,kw=None: matplotlib.pyplot.savefig(str(uuid.uuid1()))
# Original Script. Please update your script content here and once completed copy below section back to the original editing window #
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: 

# dataset = pandas.DataFrame(Preis, Fläche)
# dataset = dataset.drop_duplicates()

# Paste or type your script code here:
import seaborn as sns
import matplotlib.pyplot as plt
sns.jointplot("Preis", "Fläche", data=dataset, kind="kde", space=0.2)
plt.show()


# Epilog - Auto Generated #
os.chdir(u'C:/Users/okumhofer/PythonEditorWrapper_a97a1d23-6e1f-4284-862a-d910dc6c8745')

 

------------------------------------------------------------------

Error Message:
Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 19, in <module>
import seaborn as sns
File "C:\USERS\*******\APPDATA\LOCAL\CONTINUUM\ANACONDA3\lib\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\USERS\*******\APPDATA\LOCAL\CONTINUUM\ANACONDA3\lib\site-packages\seaborn\rcmod.py", line 5, in <module>
from . import palettes, _orig_rc_params
File "C:\USERS\*******\APPDATA\LOCAL\CONTINUUM\ANACONDA3\lib\site-packages\seaborn\palettes.py", line 12, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "C:\USERS\*******\APPDATA\LOCAL\CONTINUUM\ANACONDA3\lib\site-packages\seaborn\utils.py", line 7, in <module>
ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden.

Status: New
Comments
Community Support Team

@Oliverpmone ,

 

The code you provided is plotting code. Do not implement the code in power query, use this code in python visual.

Capture.PNG 

 

Regards,

Jimmy Tao

 

 

Frequent Visitor

Hi!

This is exaclty the code of the Python visual!

In PowerBI online the deployed report shows perfectly the plot.
And in Jupyter it also works localy.

 

But in PowerBI desktop it does not work...

 

Oliver

Community Support Team

@Oliverpmone ,

 

I have made a test on your issue but couldn't reproduce it. The seaborn lib works well on my side. Please update power bi to the latest version and check if the issue persists.

Capture.PNG 

Regards,

Jimmy Tao

Frequent Visitor

Hi!

Yes the code works, as said online the graphic is showing, but also localy with jupyter.

The path in PowerBI is corrct pointing to the python.exe

Everything is latest version.

So what else can I do?

Community Support Team

@Oliverpmone ,

 

You can create a support ticket here to achieve further support.

 

Regards,

Jimmy Tao