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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Andreas_
Regular Visitor

Can't draw Python visual using Basemap shadedrelief

Hi,

I am having some trouble drawing a simple map in Power BI using Python, now the map works fine outside of Power BI, however it throws an error saying it 'can't display the visual', and the error appears to be caused by some issue drawing a shadedrelief map.

This map is the type I have found to be the most visually appealing so I am not very keen on having to change.

 

Here is a short example displaying the problem:

 

 

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

m = Basemap(resolution='c',
            projection='cyl',
            lat_0=0,
            lon_0=0)
m.shadedrelief(scale=0.2)
plt.show()

 

 

Any ideas why this is seemingly unsupported?

 

EDIT:

Apparently doing this on a Friday afternoon is not the best time, I took one last look at the stack trace and issue was quite clear.

  File "PythonScriptWrapper.PY", line 18, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

I simply installed the dependency it was missing. I have had some problem with using anaconda, so makes sense that there would be more errors related ones!

 

 

1 ACCEPTED SOLUTION
Andreas_
Regular Visitor

As mentioned in my post edit, I had the following in my stacktrace (that I didn't check properly):

  File "PythonScriptWrapper.PY", line 18, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

 Since it worked outside of PowerBI I suspect the issue was related to me using Anaconda, as previously I had to re-install all other dependencies with pip for them to be recognized, seems I simply missed one!

View solution in original post

2 REPLIES 2
Andreas_
Regular Visitor

As mentioned in my post edit, I had the following in my stacktrace (that I didn't check properly):

  File "PythonScriptWrapper.PY", line 18, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

 Since it worked outside of PowerBI I suspect the issue was related to me using Anaconda, as previously I had to re-install all other dependencies with pip for them to be recognized, seems I simply missed one!

v-diye-msft
Community Support
Community Support

Hi @Andreas_ 

 

It seems you've fixed it, glad to know that! would you mind posting your solution in the thread and mark it as an answer that others can find it more quickly? thanks a lot!

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors