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

Issue setting data source credentials for python script as a data source

Objective:  I'm trying to schedule a refresh of a dataset in powerbi.com.  The data set has two data sources: a sql server connection and a python script.

 

Description of issue: PowerBI.com is prompting me to set the Data Source Credentials for both data sources.  I am able to set the credentials with the sql server data source but not the python.  I get an error that starts with "Failed to update data source credentials: ADO.NET: Python script error. C:\Users\richarda\Anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service ..." and continues on from there.

 

Possible source of issue: As you will see in the error message, it seems that power bi is trying to use the base Anaconda environment.  The power bi desktop file is intentionally not using Anaconda.  I initially tried using Anaconda but ran into multiple days of troubleshooting described in another post.  I finally gave up and installed standard python 3.7.7 (non-anaconda).  I pointed the desktop file to a new virtual environment I created from the non-anaconda instance. The python script runs successfully on the desktop in the intended virtual environment. I already worked through errors suggesting incorrect package versions in numpy and others and now have it running correctly.  I know the desktop file is running in the correct virtual environment because the script uses a package that I don't have installed anywhere else.  

 

Things I have done to troubleshoot (unsuccessfully):

  1. Tried creating the pbix file from scratch
  2. Confirmed that Anaconda IS NOT in Path Variable and the virtual environment IS in the path variable
  3. Confirmed that in the .pbix file, the Python Scripting path under File/Options_and_Settings is pointing to the correct virtual environment path
  4. In .pbix file, under File/Options_and_Settings/Options/CurrentFile/Privacy, the privacy level is set to "Ignore the Privacy level ..."
  5. Launch Power BI from command line while within the virtual environement directory (in a failed attempt to link the file with that virtual environment through an additional means)
  6. Reinstalled the Personal Gateway to enable refresh of on-premise source

 

Question:  Why is powerbi.com looking to the anaconda environment when it is not referenced anywhere in the pbix file and not referenced anywhere in path variable?

 

The issue is similar to what is described in this post except in that case, the power bi was pointing to the old anaconda environment instead of the new anaconda environment.  In my case, power bi is trying to use my old anaconda environment instead of the new non-anaconda environment.  https://community.powerbi.com/t5/Service/Power-BI-python-script-env-change-worked-for-PowerBI-Deskto...

 

I thought about uninstalling anaconda, but I have many many virtual environments already set up there. I prefer to not have to go through the effort to set those all up again.  

 

Any guidance is greatly appreciated

2 REPLIES 2
Anonymous
Not applicable

Hi @Richard917 ,

 

I found a similar THREAD on the internet Please check if it helps your question.

ADO.NET error trying to run Python Script in PowerBI 
Unfortunately I'm not getting clear results at the moment. Looking forward to other experts in the forum to help you solve this problem.I will continue to try to solve this problem for you as well.

 

 

Hope it helps,


Community Support Team _ Caitlyn

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

 

 

Richard917
Regular Visitor

What @Anonymous  writes in the comment section in the below post has the exact same issue as me.  No solution is provided there unfortunately

https://community.powerbi.com/t5/Issues/Python-Script-Refresh-Error-via-Service-Personal-Gateway/idc-p/2239299#M73646

 

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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