I’ve installed Python 3.11 and set up a dedicated virtual environment for my Power BI projects, but when I try to run a script in the Query Editor, it keeps saying "Python not found."
Does Power BI automatically scan the registry to detect environments, or do I have to manually point it to the python.exe in my Scripts folder every time? Also, if I have multiple versions (Base, Anaconda, and venv), how does it decide which one is the "Global" default? I'm trying to avoid DLL errors when loading pandas and matplotlib, so I really need to understand how Power BI "talks" to these local installations in 2026.
3 answers
If you're using Anaconda, the detection logic gets a bit trickier. Power BI often fails to load the necessary DLLs if you just point it to the folder, because Anaconda environments usually need to be "activated" to set the correct environment variables.
Power BI uses a hybrid detection method. By default, it attempts to scan your Windows Registry and common system paths (like AppData\Local\Programs\Python) to find standard installations. When you first enable Python scripting, it will try to populate a drop-down list with these "Detected Python Home Directories."
However, if you're using Virtual Environments (venv), Power BI won't find them automatically because they aren't registered globally. You must go to File > Options and settings > Options > Python scripting and set the directory to "Other." Then, browse specifically to the Scripts folder of your virtual environment (e.g., C:\Envs\my_pbi_env\Scripts). This forces Power BI to use that specific interpreter and its associated library stack.
Don't forget that even if Power BI detects the environment, it has two "hard" dependencies: Pandas and Matplotlib. If these aren't installed in the environment you’ve selected, the detection will "succeed," but every script will fail at runtime.
Exactly, Steven. Power BI actually checks for pandas specifically because it uses it to bridge the gap between Python’s tabular data and its own Internal Data Model. A good tip for 2026: use the py -0 command in your terminal to see exactly what the system sees. If Power BI isn't listing a version you know you have, it's likely because the installation was "for current user only" and Power BI is looking for a system-wide path.
To fix this in 2026, the best practice is to launch Power BI Desktop from the Anaconda Prompt. First, run conda activate my_env, then type PBIDesktop.exe in that same terminal. This ensures the entire environment state is inherited by Power BI. If you just point the path in the Options menu to an Anaconda folder, you’ll frequently run into ImportError: DLL load failed when calling numpy or pandas because the system doesn't know where to look for the underlying C-libraries.