I keep getting the below error when trying to run python script in power BI.
I have tried uninstalling and re-installing all numpy , pandas but to no avail.
Please i would appreciate some assistance to get this running
DataSource.Error: ADO.NET: Python script error.
<pi>C:\Users\User\anaconda3\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\User\PythonScriptWrapper_6bb79068-43bc-4932-896d-bb3c9e1e2a45\PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\Users\User\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
I have tried uninstalling and re-installing all numpy , pandas but to no avail.
Since you are using the Anaconda Python distribution you are probably pretty aware that
you have to ACTIVATE conda,
before you can run PBIDesktop.exe. This especially true if you want to include the C-libraries like the ones required for numpy.
Simple as that.
Related
Below is simple Line of code to try NumPy
import numpy as np
my_list = [1, 2, 3]
print(my_list)
print(type(my_list))
my_list_arr = np.array(my_list) # Here we are converting python list to numpy array
print(my_list_arr)
print(type(my_list_arr))
My question is: when I execute above lines of code using Jupyter-Notebook , it works well without any package issues BUT Why same line of code throwing NumPy , pandas and other package dependencies related issues when execute on PyCharm as .py file
FYI,
my setup of PyCharm project as;
python interpreter --> pointed to Anaconda provided
created PyCharm virtual environment - venv
Inherit-global-site-packages – Yes
Please help me. I am fed up with installing packages using conda and tired of doing package corrections one by one as and when ERRORs comes one after another package.
Any Better Solution please !!
Below is Error by Pycharm
D:\Mytech\IDE_workspace\PycharmProjects\python_anaconda_base_venv_and_global_site_packages\venv\Scripts\python.exe D:/Mytech/IDE_workspace/PycharmProjects/python_anaconda_base_venv_and_global_site_packages/python_for_data_science/my_NumPyArrays_practice.py
C:\Users\DELL\anaconda3\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\DELL\anaconda3\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
from . import multiarray
File "C:\Users\DELL\anaconda3\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
from . import overrides
File "C:\Users\DELL\anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Mytech\IDE_workspace\PycharmProjects\python_anaconda_base_venv_and_global_site_packages\python_for_data_science\my_NumPyArrays_practice.py", line 1, in <module>
import numpy as np
File "C:\Users\DELL\anaconda3\lib\site-packages\numpy\__init__.py", line 145, in <module>
from . import core
File "C:\Users\DELL\anaconda3\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "D:\Mytech\IDE_workspace\PycharmProjects\python_anaconda_base_venv_and_global_site_packages\venv\Scripts\python.exe"
* The NumPy version is: "1.20.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
Process finished with exit code 1
but when i am executing below code it showing. it working.
import sys
print("******************************")
print("This Code using:")
print("Python Version =", sys.version)
print("Python Interpreter =", sys.base_prefix)
print("*******************************")
print("*******************************")
This Code using:
Python Version = 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
Python Interpreter = C:\Users\DELL\anaconda3
print("*******************************")
Process finished with exit code 0
As explained in this answer, the inherit-global-site-packages inherits from your Global python install. This is the install that comes with your machine or is installed "directly" into /usr/bin or the Windows equivalent. I don't think pointing the interpreter to Anaconda will make it inherit from Anaconda, because Anaconda is not considered a global python install.
What is happening is you are inheriting from a python install that you probably did not install anything to. I can think of two solutions:
Install the packages you want in your global python install (running which python or which python3 outside of a conda env should show you where that is; after finding the command that calls the global python, pip install using that command)
Use conda environments, and just set your interpreter to different conda environments, instead of making a PyCharm env. If you are not familiar with this, you can run conda create -n NAME python=X.XX where NAME is what you want to name the environment and X.XX is the version number. From there, you can conda activate NAME, and then either pip or conda install your packages.
I'm rather new to coding, so please bare with me if I'm not using the optimal terminology to ask this question. I've installed and set up python on my Mac using pyenv based on the following link:
https://opensource.com/article/19/5/python-3-default-mac
I'm currently trying to execute a program, but I receive a ModuleNotFoundError on Numpy upon execution.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
I've checked via terminal and ensured numpy is installed, I went through the pyenv source files and confirmed numpy is there, and tried the "python -mpip install numpy" method to no avail. I'm not sure what to do at this point, so any of your suggestions would be greatly appreciated! Thank you!
I am having problems with the Numpy 1.18.5 version. I have the Python3.8 and they seem to be incompatible. I am working with Anaconda Navigator. So sorry if this is very basic but i am a beginner in this amazing world. Thanks a lot in advance.
This is the message error i get:
$ python Bikeshare.py
C:\Users\Xabi\anaconda3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "Bikeshare.py", line 2, in <module>
import pandas as pd
File "C:\Users\Xabi\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.8 from "C:\Users\Xabi\anaconda3\python.exe"
* The NumPy version is: "1.18.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: Das angegebene Modul wurde nicht gefunden.
You missed to activate the conda environment, hence the error. Try
C:\> conda activate
(Anaconda3) C:\> python Bikeshare.py
If activation doesn't work, your install is incomplete. Try
C:\> conda init
first.
I can see the error accures when the script imports Pandas. So you might need to change your pandas version too.
To check your Numpy:
Try to find your NumPy version first.
import numpy as np
print(np.__version__)
1.18.5
If it's not the version you're looking for, uninstall the current version and install the specified version:
pip uninstall numpy
pip install numpy==1.18.5
I am not sure if it's a good idea or not but I always use python's two previous version to make sure all my dependencies are all met. Since Python 3.9 is available I use python 3.7
I am trying to get VScode to work with anaconda but having issues with numpy. I have managed to get VScode to use the right python environment From VScode (ctrl+shift+P, type Python:Select Interpreter and select the appropriate option).
However, when I type "import numpy" in to my script, I get the following error message:
C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\[NAME]\Documents\python\sandpit\hello.py", line 2, in <module>
import numpy
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\ProgramData\Anaconda3\envs\sandpit\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.8 from "C:\ProgramData\Anaconda3\envs\sandpit\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
I have successfully called the 'import numpy' command from the anaconda command prompt so it seems the issue is just with VS-Code?
I have also tried to reinstall numpy from the environment with the following command conda install numpy --force-reinstall but this has no effect?
Try launching VS Code from your activated conda environment. Errors like this typically come up if you managed to run code before your shell had a chance to do a conda environment activation.
There is one step more
Launch Anaconda 3 powershell
conda init cmd.exe #to allow cmd to run VScode
Lauch VScode by the hitting the command code.
I am new in python meep. I try to use python-meep on Ubuntu 10.04 64 bit (virtual machine).
I install all the necessary things like PCRE swig and python meep, but when I try to run the samples it gives me the same error as in the beginning:
~/Desktop/Python/python-meep/samples/bent_waveguide$ python python_meep_bent_wg.py
Traceback (most recent call last):
File "python_meep_bent_wg.py", line 21, in <module>
from meep import * # make it 'meep_mpi' for MPI-meep and 'meep' for non-MPI meep
File "/usr/local/lib/python2.6/dist-packages/meep.py", line 4693, in <module>
import scipy.weave
ImportError: No module named scipy.weave
(about scipy I have a problem to install it - I get the message:
Error: Dependency is not satisfiable: python (<< 2.6)
... so I install it with dpkg -i, and then made some updates but in the end I have some kind of broken packages)
Right now I am really stuck and have no idea what to do. Maybe somebody has an idea how to fix it or install it correctly overcoming all these problems.
Try to use the python-setuptools, so you install the stuff with pip or easy_install.