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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
v-xiaoyan-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.