---
title: "Python in Power BI: Enabling Python Scripts with Anaconda Environment"
description: How to set up Python Scripting from an Anaconda environment, load your data, and use it in Power BI.
image: https://blog.continuus.ai/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20Power%20BI%20-%20Enabling%20Scripts%20with%20Anaconda%20Environment_200922.png
---

[Skip to content](https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment#main-content)

[![Continuus Logo 2024 - Horizontal - Full Color - Padded-1](https://blog.continuus.ai/hs-fs/hubfs/Continuus%20Logo%202024%20-%20Horizontal%20-%20Full%20Color%20-%20Padded-1.png?width=1803&height=665&name=Continuus%20Logo%202024%20-%20Horizontal%20-%20Full%20Color%20-%20Padded-1.png)](https://www.continuus.ai/)

- [Services](https://www.continuus.ai/services)
- [Partners](https://www.continuus-technologies.com/partners)
- Company
  
  Show submenu for Company 
  
    - [About](https://www.continuus.ai/about)
    - [Our Team](https://www.continuus.ai/our-team)
    - [Careers](https://www.continuus.ai/careers)
    - [News](https://www.continuus.ai/news-recognition)
- [Resources](https://blog.continuus-technologies.com/)
- [Contact](https://www.continuus-technologies.com/contact)

Open main navigation

Close main navigation

- [Services](https://www.continuus.ai/services)
- [Partners](https://www.continuus-technologies.com/partners)
- Company
  
  Show submenu for Company 
  
    - [About](https://www.continuus.ai/about)
    - [Our Team](https://www.continuus.ai/our-team)
    - [Careers](https://www.continuus.ai/careers)
    - [News](https://www.continuus.ai/news-recognition)
- [Resources](https://blog.continuus-technologies.com/)
- [Contact](https://www.continuus-technologies.com/contact)

[All posts](https://blog.continuus.ai/all)

 July 19, 2024

# Python in Power BI: Enabling Python Scripts with Anaconda Environment

![Picture of Lauren Busalacchi](https://blog.continuus.ai/hs-fs/hubfs/continuus-tech-oct2019-9%20(1).jpg?width=50&name=continuus-tech-oct2019-9%20(1).jpg) By  [Lauren Busalacchi](https://blog.continuus.ai/author/lauren-busalacchi)  ·   1 minute read

[Return to Resources](https://blog.continuus.ai/)

One of the nicer features of tools like Power BI and Tableau is that you can use a plethora of connection types to get both the data you need and visualizations that you need. Power BI allows users to leverage their Python knowledge in a manner that can be very easily shared with others once promoted to the server. If you are not familiar with Python, I highly recommend practicing in a Python IDE first before using it within Power BI (PBI).

 

#### Set Up

While the Power BI [Documentation](https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts) makes using a Python script as a source pretty easy, it's not so simple if you used an Anaconda environment.

Our first step is to change our PBI settings. Open PBI and simply go to File > Options & Settings > **Options**. Under the Global heading on the side, choose **Python Scripting**. You’ll want to navigate to your Anaconda environment, which should be C:\\Users\\<UserName>\\Anaconda3. Click OK, and then go ahead and close PBI.

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_1_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_1_200922.png?width=648&height=626&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_1_200922.png)

When using Python in PBI with an Anaconda environment, you have to launch PBI from said conda environment... which can be a little tricky the first time around.

First, open your **command prompt**, and enter “**conda activate**”.

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_2_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_2_200922.png?width=568&height=175&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_2_200922.png)

At this point, ensure the following libraries along with any others in your script are both installed and updated using the “**conda install**” or “**conda update**” commands:

1. pandas
2. matplotlib
3. numpy

The online consensus is that you then need to open PBI from command prompt, but if you are operating in Windows 10, you need admin access to the WindowsApp folder, which isn’t feasible for everyone. Furthermore, it seems you may get an error stating 'The provider 'Microsoft.PowerBI.OleDb' is not registered’ if you don’t open PBI from the Start menu! So you can enter the path of the PBI executable if you really want, but if you get connection or load errors, simply open from the Start menu after you have activated you conda environment.

 

#### Load Your Data

Once PBI is open, navigate to the **Get Data** menu, and choose **Python script**.

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_3_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_3_200922.png?width=609&height=137&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_3_200922.png)

**Enter your Python script**, but keep in mind that it must meet the following requirements:

1. The output must be a Panda’s dataframe, and it cannot be nested
2. The script cannot run longer than 30 minutes or require interactive calls
3. End the script with print(df)

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_4_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_4_200922.png?width=669&height=370&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_4_200922.png)

On the next screen, **check the box** next to your dataframe’s name, and hit **Load**!

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_5_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_5_200922.png?width=670&height=532&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_5_200922.png)

 

#### Your data is now available in Power BI!

When you are done, save and close your file as per usual. In the command prompt, simply type “**exit**” to close down the conda environment.

![Python in Power BI_Enabling Python Scripts with Anaconda Environment_6_200922](https://blog.continuus.ai/hs-fs/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_6_200922.png?width=187&height=315&name=Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_6_200922.png)

 

Share: [facebook-f icon](http://www.facebook.com/share.php?u=https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment) [linkedin-in icon](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment) [twitter icon](https://twitter.com/intent/tweet?url=https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment) [pinterest-p icon](http://pinterest.com/pin/create/link/?url=https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment) [envelope icon](mailto:?body=https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment)

## Related posts

[![](https://blog.continuus.ai/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Visualizations_200924/Python%20Power%20BI%20-%20Enabling%20python%20Visualizations_200924.png)](https://blog.continuus.ai/power-bi-enabling-python-visualizations)

[Blog](https://blog.continuus.ai/tag/blog)

### [Python in Power BI: Enabling Python Visualizations](https://blog.continuus.ai/power-bi-enabling-python-visualizations)

[![](https://blog.continuus.ai/hubfs/2021%20Blog%20Images/Getting%20Started%20with%20Python_Setting%20Up%20a%20Virtual%20Environment_210517/Getting%20Started%20with%20Python_Setting%20Up%20a%20Virtual%20Environment_210517.png)](https://blog.continuus.ai/getting-started-python-set-up-virtual-environment)

[Blog](https://blog.continuus.ai/tag/blog)

### [Getting Started with Python: Setting Up a Virtual Environment](https://blog.continuus.ai/getting-started-python-set-up-virtual-environment)

[![](https://blog.continuus.ai/hubfs/2020%20Blog%20Images/Getting%20Started%20with%20Python_200914/Getting%20Started%20with%20Python_200914.png)](https://blog.continuus.ai/getting-started-python)

[Blog](https://blog.continuus.ai/tag/blog)

### [Getting Started with Python](https://blog.continuus.ai/getting-started-python)

### Pages

---

### Resources

---

[Home](https://www.continuus.ai/)

[Services](https://www.continuus.ai/services)

[Partners](https://www.continuus.ai/partners)

[About](https://www.continuus.ai/about)

 

[Our Team](https://www.continuus.ai/our-team)

[Careers](https://www.continuus.ai/careers)

[News](https://www.continuus.ai/news-recognition)

[Contact](https://www.continuus.ai/contact)

Blog Posts

Case Studies

Solution Briefs

Webinars

Demos

Videos

All

[Cookies Policy](https://www.continuus.ai/cookies-policy) | [Privacy Policy](https://www.continuus.ai/privacy-policy) | [Accessibility](https://www.continuus.ai/accessibility) | *©* [*Continuus Technologies*](https://www.continuus.ai/) *2024*

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Lauren Busalacchi",
    "url" : "https://blog.continuus.ai/author/lauren-busalacchi"
  },
  "dateModified" : "2024-07-19T19:17:29.516Z",
  "datePublished" : "2020-09-23T02:37:00.000Z",
  "headline" : "Python in Power BI: Enabling Python Scripts with Anaconda Environment",
  "image" : [ "https://blog.continuus.ai/hubfs/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20Power%20BI%20-%20Enabling%20Scripts%20with%20Anaconda%20Environment_200922.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.continuus.ai/hubfs/Continuus%20Logo%202024%20-%20Horizontal%20-%20Full%20Color%20-%20Padded-1.png"
    },
    "name" : "Continuus"
  }
}
```

```json
{
  "@context" : "http://schema.org",
  "@type" : "Article",
  "author" : {
    "@type" : "Person",
    "name" : [ "Lauren Busalacchi" ],
    "url" : "https://blog.continuus.ai/author/lauren-busalacchi"
  },
  "datePublished" : "2020-09-23T02:37:00+0000",
  "description" : "How to set up Python Scripting from an Anaconda environment, load your data, and use it in Power BI.",
  "headline" : "Python in Power BI: Enabling Python Scripts with Anaconda Environment",
  "image" : "https://21082575.fs1.hubspotusercontent-na1.net/hubfs/21082575/2020%20Blog%20Images/Python%20in%20Power%20BI_Enabling%20Python%20Scripts%20with%20Anaconda%20Environment_200922/Python%20Power%20BI%20-%20Enabling%20Scripts%20with%20Anaconda%20Environment_200922.png",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://21082575.fs1.hubspotusercontent-na1.net/hubfs/21082575/Continuus%20Logo%202024%20-%20Horizontal%20-%20Full%20Color%20-%20Padded-1.png"
    },
    "name" : "Continuus"
  },
  "url" : "https://blog.continuus.ai/power-bi-python-scripts-anaconda-environment"
}
```