cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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. 

1 ACCEPTED SOLUTION
Anonymous
Not 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

View solution in original post

12 REPLIES 12
stephank
Frequent 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 

mjeh
Frequent Visitor

Step by step procedure: 

  1. Download last version of Winpython from : https://winpython.github.io/
  2. Install Winpython on C: \
  3. In Power BI Desktop, select File > Options and settings > Options > Python scripting. The Python script options page appears. 
  4. Specify the local Python installation path with the Winpython folder defined at step 2
  5. Restart Power BI

WinPython solution with a minor edit.

Step by step procedure: 

  1. Download last version of Winpython from : https://winpython.github.io/
  2. Install Winpython on C: \
  3. 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

  4. Optional: Restart Power BI

 

Hi Timo, 

I tried to set it up with the home directory at C:[...]\WPy64-3940\python-3.9.4.amd64 but got a note saying that this is an invalid path. Any ideas? 

In general and just because I'm new to this, what's the appropriate way to get Power BI able to run Python scripts (eg the one here). 

All necessary packages/libraries (pandas, numpy, matplotlib) are installed however, I am still unable to work with it. 

Any help would be really appreciated! 

Kostas

stephank
Frequent Visitor

wow, that really worked. thank you so much

 

Stephan

AndreyBear
Advocate I
Advocate I

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

 

mjeh
Frequent 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/

Nikhillearn
Frequent Visitor

Thank you for the help. This helped a lot!!

manwww
Frequent Visitor

Solved same problem by uninstalling Anaconda and installing Miniconda3 Windows 64-bit with Python 3.7 + pandas and matplotlib packages

TeigeGao
Solution Sage
Solution 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

Anonymous
Not 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

View solution in original post

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.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Top Solution Authors
Top Kudoed Authors