Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Python script works in local but fails after publishing

Hello there, 

 

I have written some Py scripts and they work fine on the Desktop version, after publishing I am reciving this error, any idea how to solve this:

 

ImportError: cannot import name 'Function name' from 'Package' (C:\Python\lib\site-packages\...\__init__.py)

 

The exact error is shown below:

 

 

MohsenH8_0-1653429502190.png

 

 

Activity ID: b6476dd7-1d82-4875-838a-33d03abd797e
Request ID: b50b4041-797f-591a-586c-73eec2b8d6e7
Correlation ID: 89779efe-d96d-89b7-0a44-6b57bb794946
Time: Wed May 25 2022 09:51:33 GMT+1200 (New Zealand Standard Time)
Service version: 13.0.18310.53
Client version: 2205.3.11455-train
Cluster URI: https://wabi-south-east-asia-redirect.analysis.windows.net/

 

Part of my code:

 

from sklearn.metrics import mean_absolute_percentage_error
from numpy import mean
from numpy import std
from numpy.random import randn
 

Thanks

M

3 REPLIES 3
Anonymous
Not applicable

Hi  @Anonymous ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

Anonymous
Not applicable

Hi Rena, Thanks for checking, these steps did not solve the problem, I am not using the gateway, so I am still lookign for other solutions.

 

Thanks,

M

lbendlin
Super User
Super User

reinstall the sklearn package.  Update to the latest version of the personal gateway.  (also validate if sklearn is even supported by the gateway)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.