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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Cannot use python visuals

Hi 

I am trying to set up powerbi to use python visuals but I get the following error:

I tried to change the python path and that still doesnt work

 


Product Version:
2.75.5649.861 (19.11) (x64)

Error Message:
An exception of type Microsoft.PowerBI.ExploreServiceCommon.ContainPIIException occured.

Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ContainPIIException: ScriptVisualCommandFlow-GenerateVisualError ---> Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, uuid, matplotlib
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 31, in <module>
import numpy as np
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
---> Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, uuid, matplotlib
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\cbook\__init__.py", line 31, in <module>
import numpy as np
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\matthewcro\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.

at Microsoft.PowerBI.Scripting.Python.PythonScriptWrapper.RunScript(String originalScript, Int32 timeoutMs)
at Microsoft.PowerBI.Client.Windows.Python.PythonScriptHandler.GenerateVisual(ScriptHandlerOptions options)
--- End of inner exception stack trace ---
at Microsoft.PowerBI.Client.Windows.Python.PythonScriptHandler.GenerateVisual(ScriptHandlerOptions options)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
--- End of inner exception stack trace ---
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.Run(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.TransformDataShapeResult(QueryCommand transformCommand, SemanticQueryDataShapeCommand command, Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ExecuteDataQuery(IQueryResultDataWriter queryResultDataWriter, EngineDataModel engineDataModel, DataQuery query, Int32 queryId, ServiceErrorStatusCode& serviceErrorStatusCode, CancellationToken cancelToken)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ProcessAndWriteSemanticQueryCommands(IQueryResultsWriter queryResultsWriter, IList`1 queries, HashSet`1 pendingQueriesToCancel, EngineDataModel engineDataModel)

Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.GetErrorDetails(ShowErrorDialogArgs args)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass2_0.<<ShowErrorDialog>b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass2_0.<ShowErrorDialog>b__0()
at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass1_0`1.<SendAndMarshalExceptions>b__0()
at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass0_1.<SendAndMarshalExceptions>b__0(Object null)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.UI.Shared.WebDialogs.WebDialog.<>n__0(IWindowHandle owner)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClass2_0.<Main>b__1()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)


OS Version:
Microsoft Windows NT 10.0.18362.0 (x64 en-US)

CLR Version:
4.7 or later [Release Number = 528040]

Peak Virtual Memory:
39.6 GB

Private Memory:
1.05 GB

Peak Working Set:
1.07 GB

IE Version:
11.476.18362.0

User ID:
b00a58a2-fa45-4b2a-afb1-7f9f54d303a3

Workbook Package Info:
1* - en-GB, Query Groups: 4, fastCombine: Disabled, runBackgroundAnalysis: True.

Telemetry Enabled:
True

Snapshot Trace Logs:
C:\Users\matthewcro\Microsoft\Power BI Desktop Store App\FrownSnapShot912280293.zip

Model Default Mode:
Import

Performance Trace Logs:
C:\Users\matthewcro\Microsoft\Power BI Desktop Store App\PerformanceTraces.zip

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_NewWebTableInference
PBI_showIncrementalRefreshPolicy
PBI_qnaLiveConnect
PQ_AIInsightsFunctionBrowser
PBI_realTimeRefresh
PBI_userFavoriteResourcePackagesEnabled
PBI_personalVisualizationPaneEnabled
PBI_QueryDiagnostics
PBI_showMinervaRibbon
PBI_showMinervaViewNavigator
PBI_decompositionTree

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

Formulas:


section Section1;

shared df_all = let
Source = Csv.Document(File.Contents("C:\Users\matthewcro\Desktop\python\load_testing\data\powerbi_data\df_all.csv"),[Delimiter=",", Columns=19, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"", Int64.Type}, {"datetime_stamp", type datetime}, {"timeStamp", Int64.Type}, {"elapsed", Int64.Type}, {"label", type text}, {"responseCode", Int64.Type}, {"responseMessage", type text}, {"threadName", type text}, {"dataType", type text}, {"success", type logical}, {"failureMessage", type text}, {"bytes", Int64.Type}, {"sentBytes", Int64.Type}, {"grpThreads", Int64.Type}, {"allThreads", Int64.Type}, {"URL", type text}, {"Latency", Int64.Type}, {"IdleTime", Int64.Type}, {"Connect", Int64.Type}})
in
#"Changed Type";

shared df_describe = let
Source = Csv.Document(File.Contents("C:\Users\matthewcro\Desktop\python\load_testing\data\powerbi_data\df_describe.csv"),[Delimiter=",", Columns=11, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"", type text}, {"timeStamp", type number}, {"elapsed", type number}, {"responseCode", type number}, {"bytes", type number}, {"sentBytes", type number}, {"grpThreads", type number}, {"allThreads", type number}, {"Latency", type number}, {"IdleTime", Int64.Type}, {"Connect", type number}})
in
#"Changed Type";

shared df_succ = let
Source = Csv.Document(File.Contents("C:\Users\matthewcro\Desktop\python\load_testing\data\powerbi_data\df_succ.csv"),[Delimiter=",", Columns=19, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"", Int64.Type}, {"datetime_stamp", type datetime}, {"timeStamp", Int64.Type}, {"elapsed", Int64.Type}, {"label", type text}, {"responseCode", Int64.Type}, {"responseMessage", type text}, {"threadName", type text}, {"dataType", type text}, {"success", type logical}, {"failureMessage", type text}, {"bytes", Int64.Type}, {"sentBytes", Int64.Type}, {"grpThreads", Int64.Type}, {"allThreads", Int64.Type}, {"URL", type text}, {"Latency", Int64.Type}, {"IdleTime", Int64.Type}, {"Connect", Int64.Type}})
in
#"Changed Type";

shared df_fail = let
Source = Csv.Document(File.Contents("C:\Users\matthewcro\Desktop\python\load_testing\data\powerbi_data\df_fail.csv"),[Delimiter=",", Columns=19, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"", Int64.Type}, {"datetime_stamp", type datetime}, {"timeStamp", Int64.Type}, {"elapsed", Int64.Type}, {"label", type text}, {"responseCode", Int64.Type}, {"responseMessage", type text}, {"threadName", type text}, {"dataType", type text}, {"success", type logical}, {"failureMessage", type text}, {"bytes", Int64.Type}, {"sentBytes", Int64.Type}, {"grpThreads", Int64.Type}, {"allThreads", Int64.Type}, {"URL", type text}, {"Latency", Int64.Type}, {"IdleTime", Int64.Type}, {"Connect", Int64.Type}})
in
#"Changed Type";

shared #"2019-12-03_PF2_C3_load_test" = let
Source = Folder.Files("C:\Users\matthewcro\Desktop\python\analysis\analysis\data\result-files\2019-12-03_PF2_C3_load_test"),
#"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
#"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
#"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"unix_start_time", Int64.Type}, {"test_status", type text}, {"region", type text}, {"bandwidth", type number}, {"cwa_build", type text}, {"Environment", type text}, {"returning_user", type logical}, {"client_type", type text}, {"total_time", Int64.Type}, {"total_time_events", type any}, {"PF1.1", Int64.Type}, {"PF1.1_events", type any}, {"PF1.2", Int64.Type}, {"PF1.2_events", type any}, {"PF1.2.1", Int64.Type}, {"PF1.2.1_events", type any}, {"PF1.2.2", Int64.Type}, {"PF1.2.2_events", Int64.Type}, {"PF1.2.2.1", Int64.Type}, {"PF1.2.2.1_events", Int64.Type}, {"PF1.2.2.2", Int64.Type}, {"PF1.2.2.2_events", Int64.Type}, {"PF1.2.2.3", Int64.Type}, {"PF1.2.2.3_events", Int64.Type}, {"PF1.2.2.4", Int64.Type}, {"PF1.2.2.4_events", Int64.Type}, {"PF1.2.2.5", Int64.Type}, {"PF1.2.2.5_events", Int64.Type}, {"PF1.2.2.6", Int64.Type}, {"PF1.2.2.6_events", Int64.Type}, {"PF1.2.2.7", Int64.Type}, {"PF1.2.2.7_events", Int64.Type}, {"PF1.2.2.8", Int64.Type}, {"PF1.2.2.8_events", Int64.Type}, {"PF1.2.3", Int64.Type}, {"PF1.2.3_events", type any}, {"PF1.2.3.1", Int64.Type}, {"PF1.2.3.1_events", Int64.Type}})
in
#"Changed Type";

shared #"Sample File" = let
Source = Folder.Files("C:\Users\matthewcro\Desktop\python\analysis\analysis\data\result-files\2019-12-03_PF2_C3_load_test"),
Navigation1 = Source{0}[Content]
in
Navigation1;

shared Parameter1 = #"Sample File" meta [IsParameterQuery=true, BinaryIdentifier=#"Sample File", Type="Binary", IsParameterQueryRequired=true];

shared #"Transform Sample File" = let
Source = Csv.Document(Parameter1,[Delimiter=",", Columns=38, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers";

[ FunctionQueryBinding = "{""exemplarFormulaName"":""Transform Sample File""}" ]
shared #"Transform File" = let
Source = (Parameter1) => let
Source = Csv.Document(Parameter1,[Delimiter=",", Columns=38, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
in
Source;

shared #"2019-12-03_PF2_C3_load_test (2)" = let
Source = Folder.Files("C:\Users\matthewcro\Desktop\python\analysis\analysis\data\result-files\2019-12-03_PF2_C3_load_test"),
#"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File (2)", each #"Transform File (2)"([Content])),
#"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
#"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File (2)"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File (2)", Table.ColumnNames(#"Transform File (2)"(#"Sample File (2)"))),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"unix_start_time", Int64.Type}, {"test_status", type text}, {"region", type text}, {"bandwidth", type number}, {"cwa_build", type text}, {"Environment", type text}, {"returning_user", type logical}, {"client_type", type text}, {"total_time", Int64.Type}, {"total_time_events", type any}, {"PF1.1", Int64.Type}, {"PF1.1_events", type any}, {"PF1.2", Int64.Type}, {"PF1.2_events", type any}, {"PF1.2.1", Int64.Type}, {"PF1.2.1_events", type any}, {"PF1.2.2", Int64.Type}, {"PF1.2.2_events", Int64.Type}, {"PF1.2.2.1", Int64.Type}, {"PF1.2.2.1_events", Int64.Type}, {"PF1.2.2.2", Int64.Type}, {"PF1.2.2.2_events", Int64.Type}, {"PF1.2.2.3", Int64.Type}, {"PF1.2.2.3_events", Int64.Type}, {"PF1.2.2.4", Int64.Type}, {"PF1.2.2.4_events", Int64.Type}, {"PF1.2.2.5", Int64.Type}, {"PF1.2.2.5_events", Int64.Type}, {"PF1.2.2.6", Int64.Type}, {"PF1.2.2.6_events", Int64.Type}, {"PF1.2.2.7", Int64.Type}, {"PF1.2.2.7_events", Int64.Type}, {"PF1.2.2.8", Int64.Type}, {"PF1.2.2.8_events", Int64.Type}, {"PF1.2.3", Int64.Type}, {"PF1.2.3_events", type any}, {"PF1.2.3.1", Int64.Type}, {"PF1.2.3.1_events", Int64.Type}})
in
#"Changed Type";

shared #"Sample File (2)" = let
Source = Folder.Files("C:\Users\matthewcro\Desktop\python\analysis\analysis\data\result-files\2019-12-03_PF2_C3_load_test"),
Navigation1 = Source{0}[Content]
in
Navigation1;

shared Parameter2 = #"Sample File (2)" meta [IsParameterQuery=true, BinaryIdentifier=#"Sample File (2)", Type="Binary", IsParameterQueryRequired=true];

shared #"Transform Sample File (2)" = let
Source = Csv.Document(Parameter2,[Delimiter=",", Columns=38, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers";

[ FunctionQueryBinding = "{""exemplarFormulaName"":""Transform Sample File (2)""}" ]
shared #"Transform File (2)" = let
Source = (Parameter2) => let
Source = Csv.Document(Parameter2,[Delimiter=",", Columns=38, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])
in
#"Promoted Headers"
in
Source;

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @Anonymous ,

After researching and discussing, I have no idea about the issue. Maybe you could create a support ticket to get a dedicated support. 

Support Ticket.gif

Best Regards,

Xue Ding

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

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors