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

11 REPLIES 11
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 

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

 

Frequent Visitor

wow, that really worked. thank you so much

 

Stephan

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

 

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/

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

Frequent Visitor

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

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
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors