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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Cannot get my Python Script Working because of importing issues with matplotlib

Hi all,

I am trying to see my python code in Power BI but I am having issues. I wrote my code on Jupyter Notebook and it works properly and shows the plot I want to see. However, when I try to run the same code in Power BI I am getting this error. Help would be appreciated.

 

Feedback Type:
Frown (Error)

Timestamp:
2022-06-28T16:08:34.9176205Z

Local Time:
2022-06-28T12:08:34.9176205-04:00

Session ID:
13ff79aa-df05-4f7a-8691-30b71e869154

Release:
May 2022

Product Version:
2.105.1143.0 (22.05) (x64)

Error Message:
Python script error.
Traceback (most recent call last):
File "C:\Users\z004knym\PythonScriptWrapper_7bcb9799-2e5e-4fcd-96e6-45deaf24f627\PythonScriptWrapper.PY", line 2, in <module>
import os, uuid, matplotlib
ModuleNotFoundError: No module named 'matplotlib'

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

According to the error message, it couldn't find the 'Matplotlib' module from the current directory. You need to install the module explicitly using the pip installer because Matplotlib is not a built-in module (it doesn’t come with the default python installation) in Python. See Install required Python packages 

vjingzhang_1-1656647313446.png

 

However, since you can run the code on Jupyter Notebook correctly, you already have Matplotlib in its environment. I guess probably you have installed Anaconda along with Jupyter Notebook, in this case you can also use Anaconda's Python directory in Power BI because Matplotlib is included in Anaconda. You can refer to PYTHON IN POWER BI: ENABLING PYTHON SCRIPTS WITH ANACONDA ENVIRONMENT 

vjingzhang_0-1656647211885.png

 

Other reference:

https://community.powerbi.com/t5/Custom-Visuals-Development/Python-Integration-Error/td-p/677350 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

According to the error message, it couldn't find the 'Matplotlib' module from the current directory. You need to install the module explicitly using the pip installer because Matplotlib is not a built-in module (it doesn’t come with the default python installation) in Python. See Install required Python packages 

vjingzhang_1-1656647313446.png

 

However, since you can run the code on Jupyter Notebook correctly, you already have Matplotlib in its environment. I guess probably you have installed Anaconda along with Jupyter Notebook, in this case you can also use Anaconda's Python directory in Power BI because Matplotlib is included in Anaconda. You can refer to PYTHON IN POWER BI: ENABLING PYTHON SCRIPTS WITH ANACONDA ENVIRONMENT 

vjingzhang_0-1656647211885.png

 

Other reference:

https://community.powerbi.com/t5/Custom-Visuals-Development/Python-Integration-Error/td-p/677350 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.