Unable to connect python script in PowerBI

Question:

I have imported data into PowerBI, I am now trying to execute some python scripting on the imported data, but I get the above error.
Please note that I have installed both numpy and pandas through the pip install function in cmd.

ERROR

Asked By: Ashwin Kumar

||

Answers:

Firstly, check whether the below steps were followed:
Click on File –> Options and settings –> Options –> Under GLOBAL section click on Python scripting –> Check the Detected Python home directories is whether Python 39 or Python310 (based on your Python version).
Click Here

Make sure that the Detected Python home directory is not of Anaconda.

Secondly, change your Detected Python IDEs from “Default OS program for .PY files” to “Other” and browse the suitable IDE of your choice.

I would recommend choosing Microsoft VS Code as I have chosen the same.
Click Here

Now let me show you the working.

Click on Get Data –> More.. –>Type Python Script in Search –> Select “Python Script” –> Click on “Connect”.
Now type the below code in the script in order to load the data. (Make sure you have given your own data path). Next click on “OK”.
Click Here

A Navigator window will be opened as shown below. Select the data required by you and click on “Load”.
Click Here

I hope my detailed answer will help you, for any further issues please feel free to reply.
Contributors from KLH:
2010030470,2010030119,2010030088,2010030155

That isn’t a valid Python home directory path. Try browsing to a folder where Python is installed.

I can think of 2 possibilities of you getting the above error, either you haven’t installed Python in your C Drive, or you are trying to browse the path from Start Menu and copying the same path in the directory which will eventually give the above error as that’s not the exact path of your python.

Try to locate the folder in your respective directory where you have downloaded the python with a naming convention of Python39 or Python310 (based on your Python version) as shown below.

enter image description here

Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.