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
GianlucaM
Helper II
Helper II

Python integration

Hi,

i'm trying to integrate my scritp python in power BI, an easy one just to start, but i'm encountering difficulties
having this setting in powerbi

GianlucaM_0-1666191391603.png

i'm trying to connect python 3.8 but it seems not able to load some libraries: when I run this basic script

GianlucaM_1-1666191450910.png

I always have this message back with this error which i'm not able to solve

"Stack Trace:

Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: Python script error.

  File "PythonScriptWrapper.PY", line 20

    pip install matplotlib

        ^

SyntaxError: invalid syntax"

 

Thanks for any help on this,


regards
G

1 ACCEPTED SOLUTION
GianlucaM
Helper II
Helper II

Hi,

 

no actually this wasn't the solution, i've been able to find a solution by myself. 

I had to run python (not an IDE) and load the libraries

Gianluca

View solution in original post

2 REPLIES 2
GianlucaM
Helper II
Helper II

Hi,

 

no actually this wasn't the solution, i've been able to find a solution by myself. 

I had to run python (not an IDE) and load the libraries

Gianluca

Anonymous
Not applicable

Hi @GianlucaM ,

Please have a check.

If necessary, specify your local Python installation path in Detected Python home directories.

In the above image, the Python's installation local path is C:\Python. Make sure the path is for the local Python installation you want Power BI Desktop to use.

 

When preparing and running a Python script in Power BI Desktop, there are a few limitations:

  • Only pandas data frames are imported, so make sure the data you want to import to Power BI is represented in a data frame
  • Any Python script that runs longer than 30 minutes times out
  • Interactive calls in the Python script, such as waiting for user input, halts the script’s execution
  • When setting the working directory within the Python script, you must define a full path to the working directory, rather than a relative path
  • Nested tables are currently not supported

Run Python Scripts in Power BI Desktop - Power BI | Microsoft Learn

 

I hvae also found a similar post, please refer to it to see if it helps you.

Solved: Power BI Python ADO.NET: Python Script Error - Microsoft Power BI Community

Solved: Python integration error - Microsoft Power BI Community

 

Best Regards

Community Support Team _ Polly

 

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

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.