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
FilipFireFlyBI
Resolver I
Resolver I

SKlearn not working in PowerBI Desktop

Hi all,

 

I try to import this Python code that works properly in Spyder (Python 3.7):

See this YouTube video: https://www.youtube.com/watch?v=0zveIwThlfE&t=145s (watch from 6:00min).

 

Spyder_Python_code.PNG

However, when I copy this code to PowerBI I get this error message:

PowerBI_error_SKLEARN.PNG

 

My machine CMD tells me this:

CMD.PNG

Important to note: In Power BI I use the Python home directory as indicated in CMD. When I use Python code with only Panda's, Numpy or Matplotlib there are no issues at all in my Power BI Desktop.

 

Any idea what is wrong / how to solve?

Thanks in advance!!

6 REPLIES 6
nuwanhwb
Frequent Visitor

Hi,

Try the below . It may help
Use "conda install scikit-learn" instead of conda install sklearn

FilipFireFlyBI
Resolver I
Resolver I

Hi all,

 

I have tried to get this working (back in 2019). What I can remember is that this finally did not work.

I have not tried other options anymore.

 

Regards,

Filip

nirvanamike
Regular Visitor

@FilipFireFlyBI have you found a solution to this? I am stuck as well. Everything works well besides the sklearn import. The above didnt work for me either.

I am also stuck in this as well. Are there any option

v-lionel-msft
Community Support
Community Support

Hi @FilipFireFlyBI ,

Please modify your code like this and try again.

components = pd.DataFrame(list(zip(x.columns, coef)), columns = ['component', 'value']) 

If it still doesn't work, please check your user environment variables:
e1.PNG
 

Best regards,
Lionel Chen

 

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

Hi Lionel Chen,


Thanks for reply but both options did not work for me.

 

Regards,

Filip

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.

Top Solution Authors