Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
When I try to import a dataframe to Power BI using a Python script I get the following error
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\jonow\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
"
This happens even when I enter no Python code, and the code runs fine in an IDE.
I am using Python with anaconda so the file Path I have specified in Power BI is C:\Users\Username\Anaconda3
Is this correct ? ? ?
Tried everything and cant get this working.
Solved! Go to Solution.
Hi @Anonymous @jono,
@Anonymous Thank you for your information. Power doesn't have the feature which can run a cmd batch file when open. As a workaround, you can install the batch as a windows service. Please refer to: https://stackoverflow.com/questions/415409/run-batch-file-as-a-windows-service.
Regards,
Jimmy Tao
Hello,
I have the same problem. I kind of understand why. I am also using Anaconda and I get the same error when I try to run a query:
Hi @Anonymous @jono,
@Anonymous Thank you for your information. Power doesn't have the feature which can run a cmd batch file when open. As a workaround, you can install the batch as a windows service. Please refer to: https://stackoverflow.com/questions/415409/run-batch-file-as-a-windows-service.
Regards,
Jimmy Tao
So I could not solve it using the service approach. Besides, it is kind of hackish. I ended up doing another straight Python install using the conventional windows installer and then pip installing the pandas package. I put this intalled version of Python in the PATH environment variable.
So I have two installations of the same versions of Python 3.7. One with Anaconda, and another by itself. Since the standalone Python does not require activation of the Conda environment, it worked fine.
I know it is sub-optimal, but it works. Power BI developers need to support different Pyenv and Conda environments in the future releases of Python support.
Bharat
Thank you @Anonymous , this worked! I only had Anaconda as well (as I'm sure many will or Anaconda/Pycharm), so this was the only suggestion that worked for me. I can't wait to have fun with Python + PowerBI !
1) As mentioned, I had to pip install Pandas (which then automatically installs numpy because of dependencies).
2) Additionally, I had to also pip install matplotlib (even though my script did not import matplotlib).
Hi jono,
This may caused by numpy module hasn't be installed when you installed anaconda. You can open CMD and type "conda list" to check all the modules included by anaconda, if numpy is not listed, type "conda install numpy" to install numpy module.
Regards,
Jimmy Tao
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |