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
shmat
Regular Visitor

Error with SEABORN

Hi,

 

I am getting error when trying to import seaborn and work with it.

 

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# create data
x = np.random.rand(80) - 0.5
y = x+np.random.rand(80)
z = x+np.random.rand(80)
df = pd.DataFrame({'x':x, 'y':y, 'z':z})
# Plot with palette
sns.lmplot( x='x', y='y', data=df, fit_reg=False, hue='x', legend=False, palette="Blues")
plt.show()
 
Interestingly, when using matplotlib veerything works fine.
 
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# create data
x = np.random.rand(80) - 0.5
y = x+np.random.rand(80)
z = x+np.random.rand(80)
df = pd.DataFrame({'x':x, 'y':y, 'z':z})
# Plot with palette
plt.plot(x,y,'b.')
plt.show()
 
The error I get when attempting to import seaborn is:
 
Error Message:
Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 16, in <module>
import seaborn as sns
File "C:\Users\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\Users\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\seaborn\rcmod.py", line 5, in <module>
from . import palettes, _orig_rc_params
File "C:\Users\paeres\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\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\seaborn\utils.py", line 7, in <module>
from scipy import stats
File "C:\Users\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\stats\__init__.py", line 345, in <module>
from .stats import *
File "C:\Users\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\stats\stats.py", line 169, in <module>
import scipy.special as special
File "C:\Users\paeres\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
9 REPLIES 9
RomanSk
Frequent Visitor

shmat - Have you solved the problem? I have the same issue.


@RomanSk wrote:

shmat - Have you solved the problem? I have the same issue.


Hi RomanSk,

 

Unfortunately, I did not manage to make it work. Still cannot find the reason.

Please let me know if you manage.

I have tried re-installing Power BI and re-installing the library.

RomanSk
Frequent Visitor

Untitled.pngI solved it this way. I changed home directory from C:\python to C:\Program Files\Python37 in options - Python scripting and it works.

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @shmat ,

By my tests and research, your issue may be caused by that you didn't install the package seaborn.

You need install the package seaborn with command like below.

install package.PNG

Then use your script in Power BI Desktop, you could get the output.

python visual.PNG

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

Thank you for your swift reply. Seaborn package has been installed before and, to be on the safe side, I did it again now.

2.PNG

 

This, however, did not solve my problem. I am still getting the same error.

Could there be anything else I am doing wrong? Maybe some other updates are needed?

 

In fact, the error is coming from "import seaborn as sns". If I run simply "import matplotlib.pyplot as plt" it says:

1.PNG

 

I do not get why seaborn does not work...

Hi @shmat ,

Please check if you have installed the latest version of Power BI Desktop (2.69.5467.1751).

In addition, please have a test with the pbix attached which run Seaborn well in your environment.

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

Thank you again for your feedback. I tried the attached pbix and I it fails for me (the visual does not appear).

Have also checked the version of Power BI Desktop and it matches the one you say is the latest.

 

Do you have any other idea of what I might be missing/doing wrong?

 

Best regards,

Shmat 

Hi @shmat ,

Have you tried with the suggestion of cnweke? Does it work?

If it works, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still have this issue, please share the screenshot of your command which install the package.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Could you 'reinstall' it through:

conda install seaborn

and try again?  

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.