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
Anonymous
Not applicable

Can't run any Python script in Power BI Desktop

Hello everyone,

 

i installed python to implement a visualization with python to power bi.

 

My visualization ist the following code.

I paste this in the script editor in power bi to show the visual in power bi but i always get a error message but i dont know why.

 

In juypter the code is working.

 

import matplotlib.pyplot as plt
import numpy as np

width = 0.8

highPower = [1184.53,1523.48,1521.05,1517.88,1519.88]
lowPower = [1000.95,1233.37, 1198.97,1198.01,1214.29]
medium = [800,805,803,790,795]
medium2 = [500,502,503,504,540]

indices = np.arange(len(highPower))

plt.bar(indices, highPower, width=width,
color='b', label='Max Power in mW')

plt.bar([i+0.3*width for i in indices], lowPower,
color='r', alpha=1, label='Min Power in mW')

plt.bar([i+0.6*width for i in indices], medium,
color='g', alpha=1, label='Med Power in mW')

plt.bar([i+0.9*width for i in indices], medium2,
color='y', alpha=1, label='Min Power in mW')

plt.xticks(indices+width/8,
['T{}'.format(i) for i in range(len(highPower))] )

 

plt.show()

 

Thank you for your help in advance.

 

Best regards

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You can upgrade the Python , pandas and numpy to the latest version in cmd prompt or Anaconda prompt .

 

1.use cmd prompt below:

pip upgrade python

 

pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy

 

2.use conda prompt below:

conda upgrade python

 

conda install pandas

conda install numpy

 

There some similar cases you can refer to : https://stackoverflow.com/questions/41859939/python-pandas-missing-required-dependencies-numpy-1,

https://stackoverflow.com/questions/53587001/missing-required-dependencies-numpy-for-anaconda-ver5-3-1-on-pycharm ,

https://stackoverflow.com/questions/44220798/pandas-missing-required-dependencies-numpy ,

https://stackoverflow.com/questions/42973666/importerror-missing-required-dependencies-numpy .

 

Best Regards,

Amy

 

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

5 REPLIES 5
SeydaOztop
Regular Visitor

Hello, I want to transfer the data I wrote and prepared in PyCharm to PowerBI. However, Pycharm does not see my file. Can I connect only exe to PowerBI? How can I transfer the data I prepared in Pycharm to PowerBI? I get the error in the screenshot while trying to connect. I request your help.

powerbı.png

v-xicai
Community Support
Community Support

Hi  @Anonymous ,

 

Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You can refer to the links https://docs.microsoft.com/en-us/power-bi/desktop-python-scripts,     https://www.sqlshack.com/power-bi-desktop-and-python-like-peanut-butter-and-chocolate/ , pay attention to the steps and key points.

Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

 

Or could you please show us the error message for further analysis?

 

Best Regards,

Amy

 

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

Anonymous
Not applicable

Unbenannt.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This is the error message when i try to paste my script into power bi.

I do this with the Get Data option and use python script.

 

I use anaconda and i should have alle the packages it mentioned above to import.

Hi @Anonymous ,

 

You can upgrade the Python , pandas and numpy to the latest version in cmd prompt or Anaconda prompt .

 

1.use cmd prompt below:

pip upgrade python

 

pip uninstall pandas
pip uninstall numpy
pip install pandas
pip install numpy

 

2.use conda prompt below:

conda upgrade python

 

conda install pandas

conda install numpy

 

There some similar cases you can refer to : https://stackoverflow.com/questions/41859939/python-pandas-missing-required-dependencies-numpy-1,

https://stackoverflow.com/questions/53587001/missing-required-dependencies-numpy-for-anaconda-ver5-3-1-on-pycharm ,

https://stackoverflow.com/questions/44220798/pandas-missing-required-dependencies-numpy ,

https://stackoverflow.com/questions/42973666/importerror-missing-required-dependencies-numpy .

 

Best Regards,

Amy

 

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.