Forum Discussion
Power BI Python with Anaconda missing dependency
Hi,
I'm trying to use my Python script in Power BI, however I'm faced with this error message when trying to run it:
Details: "ADO.NET: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib.pyplot
File "C:\Users\name\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
"I understand that it has something to do with the Anaconda environment not being activated. But is there a fix for this? I'd really like to avoid working with multiple Python versions.
- Anonymous7 years ago
The Python environment I'm referring to already has the required dependencies installed. I was suspecting the error to be caused by the activate.bat file not activating the Python environment in Anaconda, prior to running the script. However, I managed to resolve my problem simply by updating Python in Anaconda Prompt i.e.
conda upgrade python
15 Replies
- AndreyBearAdvocate II
Some more flavor on this from Nov 2019.
After many, many, many troubleshooting itterations, the only evnironment version that works is the one with pip-installed matplotlib, pandas and numpy.
As soon as conda install touches either pandas or numpy in particular - the two get desynced.
Here is a working collection:
astroid 2.3.1
certifi 2019.9.11
colorama 0.4.1
cycler 0.10.0
isort 4.3.21
kiwisolver 1.1.0
lazy-object-proxy 1.4.2
matplotlib 3.1.1
mccabe 0.6.1
numpy 1.17.4
pandas 0.25.3
pip 19.3.1
pylint 2.4.2
pyparsing 2.4.5
python-dateutil 2.8.1
pytz 2019.3
setuptools 41.6.0.post20191030
six 1.12.0
typed-ast 1.4.0
wheel 0.33.6
wincertstore 0.2
wrapt 1.11.2- mjehFrequent Visitor
I had a lot of difficulties making Python working with Power BI
The solution I'm using : an independent install of Python with https://winpython.github.io/
- NikhillearnFrequent Visitor
Thank you for the help. This helped a lot!!
- AnonymousNot applicable
This solved the problem for me as well
- AnonymousNot applicable
Thank you so much. This was the ticket. As long as you create a new environment and have pip install those 3 packages I was able to open pbi as normal without having to do the workaround from lauching within anaconda prompt. Just make sure you switch to the new environment in the pbi options. Also, I had to use conda install to first install pip itself in the new environment. At that point I used pip to install these 3 required packages.
- TeigeGaoSolution Sage
Hi Anonymous ,
The error message "ImportError: Missing required dependencies ['numpy']" indicates that some library you imported requires the dependencies ['numpy'], after checking your code, it should be pandas.
In this scenario, we can install the numpy library by using the "pip install numpy".
Best Regards,
Teige
- AnonymousNot applicable
The Python environment I'm referring to already has the required dependencies installed. I was suspecting the error to be caused by the activate.bat file not activating the Python environment in Anaconda, prior to running the script. However, I managed to resolve my problem simply by updating Python in Anaconda Prompt i.e.
conda upgrade python
- pkoetzingAdvocate III
Every Anaconda environment requires activation before you can use it properly. Sounds familiar?
1. Open the Anaconda prompt.
2. Activate the environement that you configured in the PowerBI Desktop Scripting Options.
3. Start your PBIDesktop.exe from the prompt.
Simple as that.
- AnonymousNot applicable
Solved same problem by uninstalling Anaconda and installing Miniconda3 Windows 64-bit with Python 3.7 + pandas and matplotlib packages
- stephankFrequent Visitor
can you please refere to a step-by-set setup. It seems using python directory and IDE anaconda's python exe file
I cannot get it run with a demo script
- mjehFrequent Visitor
Step by step procedure:
- Download last version of Winpython from : https://winpython.github.io/
- Install Winpython on C: \
- In Power BI Desktop, select File > Options and settings > Options > Python scripting. The Python script options page appears.
- Specify the local Python installation path with the Winpython folder defined at step 2
- Restart Power BI
- TimoRiikonenAdvocate V
WinPython solution with a minor edit.
Step by step procedure:
- Download last version of Winpython from : https://winpython.github.io/
- Install Winpython on C: \
- In Power BI Desktop, select File > Options and settings > Options > Global > Python scripting. Set
Python home directory as something like C:\WPy64-3770\python-3.7.7.amd64
- Optional: Restart Power BI