Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Error when running Python Visualisation Script in Power BI Service

Hi all,

I have built a Python visualisation script in Power BI Desktop which performs the following steps:

  • Accepts an URL for an image in the dataset dataframe
  • Retrieves the image from the external URL via an image reformatting service called
  • Modifies the image
  • Displays the image within the visualisation

This works perfectly in Power BI Desktop but when I upload the PBIX to Power BI Service I get the following error.

 Traceback (most recent call last):
 File "C:\Script\", line 35, in <module>
 img = mpimg.imread(''+dataset.iloc[0].R_CoverImage)
 File "C:\Python\lib\site-packages\matplotlib\", line 1363, in imread
 fd = BytesIO(urllib.request.urlopen(fname).read())
 File "C:\Python\Lib\urllib\", line 222, in urlopen
 return, data, timeout)
 File "C:\Python\Lib\urllib\", line 525, in open
 response = self._open(req, data)
 File "C:\Python\Lib\urllib\", line 543, in _open
 '_open', req)
 File "C:\Python\Lib\urllib\", line 503, in _call_chain
 result = func(*args)
 File "C:\Python\Lib\urllib\", line 1360, in https_open
 context=self._context, check_hostname=self._check_hostname)
 File "C:\Python\Lib\urllib\", line 1319, in do_open
 raise URLError(err)
 urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>
Please try again later or contact support. If you contact support, please provide these details.

My Google searches suggest that the error is caused by the hostname not being resolved so I'm guessing that the scripting engine within Power BI service does not have access to a DNS to complete the request.


Can anyone confirm this or suggest a walkaround?






Frequent Visitor

Hi, did you have any luck with this? I can't get imread or imshow to work in the service.



Worked through with support but unfortuanately the Python functionality is sandboxed to restrict access to external content.


We are now using the Simple Image visualisation and overlay a Python visualisation on top to achieve the desired outcome.





Community Support
Community Support

HI, @michaelstone 

For your case, I would suggest you create a support ticket here to get further help.

Go to Scroll down and click "CREATE SUPPORT TICKET".

submit a support ticketsubmit a support ticket


Best Regards,


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

Helpful resources


Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors