Reading feather files in Power BI
Now that we know how to set up our local virtual environment and install the required packages, we can start reading the feather file in Power BI. First act...
-V:3.9 Python 3.9 (64-bit)
The *
indicates the default version.
By default Power BI comes with a version of Python. You can check the version of Python that is installed by opening Power BI and going to File
> Options and settings
> Options
> Python scripting
. Here you can see the version of Python that is installed.
However for the following posts we are going to set up a virtual environment. This is a clean environment that is isolated from the rest of the system. This way we can install packages without affecting the rest of the system. Check out my former post on how to set up a virtual environment.
In the command prompt, navigate to the folder where you want to create the virtual environment. I went for the folder C:\pythonvenvs
. Now type python -m venv powerbivenv
. This will create our demo virtual environment. To activate the virtual environment, navigate to the Scripts
folder and type activate
. Or from the root folder of the virtual environment, type .\powerbivenv\Scripts\activate
.
You can check if the virtual environment is activated by checking the command prompt. The name of the virtual environment should be displayed in the prompt.
To use the virtual environment in Power BI, you need to set the path to the virtual environment in Power BI. You can do this by going to File
> Options and settings
> Options
> Python scripting
and setting the path to the virtual environment in the Set a Python home directory
field. In my case the path is C:\pythonvenvs\powerbivenv\Scripts
. Note that the path should point to the Scripts
folder of the virtual environment as that’s where the activation commands reside.
Now you can use the virtual environment in Power BI. In the next post, I will show you how to use Python in Power BI.
Leave a Comment