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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nick_Bo
New Member

Python integration not working.

I'm new to Power BI and recently installed Python 3.11 (IDLE).

I enabled python scripting in Power BI and can load a dataframe. However when I run a script to  create a plot it does not work and I get the error message below.  I have reinstalled matplotlib and kiwisolver using --no-cache-dir I hope someone can point me in the right direction to resolve.

 

Feedback Type:
Frown (Error)

Stack Trace:
Javascript: Error
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: Python script error.
Traceback (most recent call last):
File "C:\Users\xxxx\PythonScriptWrapper_b5493b6f-63a2-418f-829e-d4261ebd04ba\PythonScriptWrapper.PY", line 2, in <module>
import os, uuid, matplotlib
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\matplotlib\__init__.py", line 242, in <module>
_check_versions()
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\matplotlib\__init__.py", line 236, in _check_versions
module = importlib.import_module(modname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRAM FILES\PYTHON311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\kiwisolver\__init__.py", line 8, in <module>
from ._cext import (
ImportError: DLL load failed while importing _cext: The specified module could not be found.
---> Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException: Python script error.
Traceback (most recent call last):
File "C:\Users\xxxx\PythonScriptWrapper_b5493b6f-63a2-418f-829e-d4261ebd04ba\PythonScriptWrapper.PY", line 2, in <module>
import os, uuid, matplotlib
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\matplotlib\__init__.py", line 242, in <module>
_check_versions()
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\matplotlib\__init__.py", line 236, in _check_versions
module = importlib.import_module(modname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRAM FILES\PYTHON311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxx\AppData\Roaming\Python\Python311\site-packages\kiwisolver\__init__.py", line 8, in <module>
from ._cext import (
ImportError: DLL load failed while importing _cext: 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.ExploreHost.SemanticQuery.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.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)

PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.118.1063.0","ModuleName":"","Component":"","Error":"Error","MethodDef":"","ErrorOffset":"-1:-1","ErrorCode":""}

OS Version:
Microsoft Windows NT 10.0.19045.0 (x64 en-GB)

CLR Version:
4.8 or later [Release Number = 528372]

Peak Virtual Memory:
70.7 GB

Private Memory:
737 MB

Peak Working Set:
977 MB

IE Version:
11.789.19041.0

User ID:
xxx

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

Telemetry Enabled:
True

Model Default Mode:
Import

Model Version:
PowerBI_V3

Enabled Preview Features:
PBI_sparklines
PBI_scorecardVisual
PBI_NlToDax
PBI_fieldParametersSuperSwitch
PBI_horizontalFusion
PBI_setLabelOnExportPdf
PBI_newCard

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_qnaLiveConnect
PBI_b2bExternalDatasetSharing
PBI_enhancedTooltips
PBI_angularRls
PBI_onObject
PBI_dynamicFormatString
PBI_oneDriveSave
PBI_oneDriveShare
PBI_gitIntegration

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

DPI Scale:
100%

Supported Services:
Power BI

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.