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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
WassimSlim
New Member

Python script module not found

Hi everyone, so I have a little problem, I just published my project in powerbi web, I have a python script in the report that uses a fastf1 module and works fine in the powerBI desktop, the error it shows me in the web part that : 

- ModuleNotFoundError: No module named 'fastf1'

Also, I have question about embedding the report in an Angular web application, I want to use PowerBIEmbedModule instead of iframe tags, so how can I find my <Access Token> and other parameters as it is described in the following code :

 

<powerbi-report [embedConfig] = {{ type: "report", id: "<Report Id>", embedUrl: "<Embed Url>", accessToken: "<Access Token>", tokenType: models.TokenType.Embed, settings: { panes: { filters: { expanded: false, visible: false } }, background: models.BackgroundType.Transparent, } }} [cssClassName] = { "reportClass" } [phasedEmbedding] = { false } [eventHandlers] = { new Map([ ['loaded', () => console.log('Report loaded');], ['rendered', () => console.log('Report rendered');], ['error', (event) => console.log(event.detail);] ]) } > </powerbi-report>

 

 

 A last question, can i select a specific page to visualize without showing the whole report every single time or a specific component of a page like (Pie chart, table, etc ...) .
thank you for helping me 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @WassimSlim ,

 

1. Python script works well in Power BI Desktop, but will show error in Power BI Service.

I think you have unsupported Python packages versions.

Please go to this link:Create visuals by using Python packages in the Power BI service and install PowerBI supported Python packages versions.

 

2. How can I find my <Access Token> and other parameters as it is described in the following code?

 

Report ID is the code after/report/ in your report url. 

Embed Url is the code Power BI will provide to you when you use embed.

 

Get Access token in Power BI Desktop:

() =>

 

let

    body = "client_id=" & #"App ID"

    & "&scope=https://analysis.windows.net/powerbi/api/.default&client_secret=" & #"App Secret"

    & "&grant_type=client_credentials",

    Data= Json.Document(Web.Contents("https://login.microsoftonline.com/"& TenantID & "/oauth2/v2.0/token/",

    [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),

    access_token = Data[access_token]

in

    access_token

OR

() =>

 

let

    body =  "&grant_type=Password&resource = https://analysis.windows.net/powerbi/api

&client_id=*****&username=*****&password=*****",

    
 Data=Json.Document(Web.Contents("https://login.microsoftonline.com/common/oauth2/v2.0/token/",

    [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),

    access_token = Data[access_token]

in

    access_token

 

Then you can replace bear token by the access token parameter.

RicoZhou_0-1652087202333.png

It will refresh every time your refresh your report.

Video: How to get access token and call Rest API by dynamic access token in Power BI Desktop? (5:30 to 9:30)

all Power BI Rest API with Dynamic Access Token From Power BI Desktop |Power BI Rest API

 

3.Can i select a specific page to visualize without showing the whole report every single time or a specific component of a page like (Pie chart, table, etc ...) ?

For reference:

Embed a report visual

 

Best Regards,
Rico Zhou

 

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

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @WassimSlim ,

 

1. Python script works well in Power BI Desktop, but will show error in Power BI Service.

I think you have unsupported Python packages versions.

Please go to this link:Create visuals by using Python packages in the Power BI service and install PowerBI supported Python packages versions.

 

2. How can I find my <Access Token> and other parameters as it is described in the following code?

 

Report ID is the code after/report/ in your report url. 

Embed Url is the code Power BI will provide to you when you use embed.

 

Get Access token in Power BI Desktop:

() =>

 

let

    body = "client_id=" & #"App ID"

    & "&scope=https://analysis.windows.net/powerbi/api/.default&client_secret=" & #"App Secret"

    & "&grant_type=client_credentials",

    Data= Json.Document(Web.Contents("https://login.microsoftonline.com/"& TenantID & "/oauth2/v2.0/token/",

    [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),

    access_token = Data[access_token]

in

    access_token

OR

() =>

 

let

    body =  "&grant_type=Password&resource = https://analysis.windows.net/powerbi/api

&client_id=*****&username=*****&password=*****",

    
 Data=Json.Document(Web.Contents("https://login.microsoftonline.com/common/oauth2/v2.0/token/",

    [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])),

    access_token = Data[access_token]

in

    access_token

 

Then you can replace bear token by the access token parameter.

RicoZhou_0-1652087202333.png

It will refresh every time your refresh your report.

Video: How to get access token and call Rest API by dynamic access token in Power BI Desktop? (5:30 to 9:30)

all Power BI Rest API with Dynamic Access Token From Power BI Desktop |Power BI Rest API

 

3.Can i select a specific page to visualize without showing the whole report every single time or a specific component of a page like (Pie chart, table, etc ...) ?

For reference:

Embed a report visual

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.