Running numpy.fft.fft(np.eye(9),norm="ortho) leads to TypeError: fft() got an unexpected keyword argument 'norm'. I am running Numpy with Intel MKL. Could it be that there is something wrong with the linkings inside the libraries?
            Asked
            
        
        
            Active
            
        
            Viewed 1,531 times
        
    1
            
            
        
        mmarah
        
- 83
 - 9
 
- 
                    You have an old version of `numpy`, you need to update. How did you install `numpy`? – Holt Aug 05 '16 at 09:53
 - 
                    I installed it following this [https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl](https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl). I remember, that I had to specify the flags in site.cfg to get it running. Indeed, my numpy version is 1.9.3. I'll try to update it and see if it works. – mmarah Aug 05 '16 at 11:20
 - 
                    If you are on Windows, I would highly recommend downloading the wheel file from [this site](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy). These are already compiled using Intel MKL, and are really easy to install, just do `pip install numpy-1.11.1+mkl-cp27-cp27m-win32.whl` (or whatever version you downloaded). – Holt Aug 05 '16 at 11:23
 - 
                    Alright. I'm on Linux. Nevertheless I updated numpy via pip and it works now. For some reason I thought it would be included via a normal update run of the system (fedora24, dnf update). But it is not included. Have to keep that in mind in future. Thank you very much. – mmarah Aug 05 '16 at 11:44
 - 
                    Be careful that the update with `pip` did use MKL, I am pretty sure it is not the default (you can check with `numpy.show_config()`). – Holt Aug 05 '16 at 11:45
 - 
                    Yes, you are right again. I guess I can fix this somehow. – mmarah Aug 05 '16 at 11:50
 - 
                    Also, consider trying Intel’s Python distribution beta (though we’ve used it on internal projects and it works fine): https://software.intel.com/en-us/python-distribution pre-compiled with MKL, supports all three major OSes, and I believe it has a commercial-compatible license (though I don’t see where it says that on the front page right now). – Ahmed Fasih Aug 05 '16 at 12:07
 - 
                    I fixed it with an reinstall, using the newest version of numpy and link it to the libraries (site.cfg). I tried IPD and can also recommend this way. It is easy to install and up to now runs like a charm. – mmarah Aug 12 '16 at 15:12
 
1 Answers
2
            
            
        I got your statement to work with the below steps:
Download the latest Intel distribution of Python from Intel's site (in my case, I used an April 3, 2022 release): https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html#python
Activate the new Intel Python environment with conda. For example:
conda activate "C:\Program Files (x86)\Intel\oneAPI\intelpython\python3.9"
- Install Intel numpy with pip (see https://pypi.org/project/intel-numpy/):
 
pip install intel-numpy
- If you type 
pythonin the command line, you should see that Intel Python is installed: 
Python 3.9.10 (main, Mar 21 2022, 08:44:00) [MSC v.1916 64 bit (AMD64)] :: Intel Corporation on win32
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
- Now if you 
import numpyand on a new line typenumpy.show_config(), you should see the MKL libraries linked: 
blas_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
blas_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
lapack_mkl_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
lapack_opt_info:
    libraries = ['mkl_rt']
    library_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['C:/Program Files (x86)/Intel/oneAPI/intelpython/python3.9\\Library\\include']
Supported SIMD extensions in this NumPy install:
    baseline = SSE,SSE2,SSE3,SSSE3,SSE41,POPCNT,SSE42
    found = AVX512_ICL
    not found =
- If I run:
 
fft = numpy.fft.fft(np.eye(9),norm="ortho)
print(fft)
The output is:
[[ 0.33333333+0.j          0.33333333-0.j          0.33333333-0.j
   0.33333333-0.j          0.33333333+0.j          0.33333333-0.j
   0.33333333+0.j          0.33333333+0.j          0.33333333+0.j        ]
 [ 0.33333333+0.j          0.25534815-0.21426254j  0.05788273-0.32826925j
  -0.16666667-0.28867513j -0.31323087-0.11400671j -0.31323087+0.11400671j
  -0.16666667+0.28867513j  0.05788273+0.32826925j  0.25534815+0.21426254j]
 [ 0.33333333+0.j          0.05788273-0.32826925j -0.31323087-0.11400671j
  -0.16666667+0.28867513j  0.25534815+0.21426254j  0.25534815-0.21426254j
  -0.16666667-0.28867513j -0.31323087+0.11400671j  0.05788273+0.32826925j]
 [ 0.33333333+0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j
   0.33333333-0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j
   0.33333333+0.j         -0.16666667-0.28867513j -0.16666667+0.28867513j]
 [ 0.33333333+0.j         -0.31323087-0.11400671j  0.25534815+0.21426254j
  -0.16666667-0.28867513j  0.05788273+0.32826925j  0.05788273-0.32826925j
  -0.16666667+0.28867513j  0.25534815-0.21426254j -0.31323087+0.11400671j]
 [ 0.33333333+0.j         -0.31323087+0.11400671j  0.25534815-0.21426254j
  -0.16666667+0.28867513j  0.05788273-0.32826925j  0.05788273+0.32826925j
  -0.16666667-0.28867513j  0.25534815+0.21426254j -0.31323087-0.11400671j]
 [ 0.33333333+0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j
   0.33333333-0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j
   0.33333333+0.j         -0.16666667+0.28867513j -0.16666667-0.28867513j]
 [ 0.33333333+0.j          0.05788273+0.32826925j -0.31323087+0.11400671j
  -0.16666667-0.28867513j  0.25534815-0.21426254j  0.25534815+0.21426254j
  -0.16666667+0.28867513j -0.31323087-0.11400671j  0.05788273-0.32826925j]
 [ 0.33333333+0.j          0.25534815+0.21426254j  0.05788273+0.32826925j
  -0.16666667+0.28867513j -0.31323087+0.11400671j -0.31323087-0.11400671j
  -0.16666667-0.28867513j  0.05788273-0.32826925j  0.25534815-0.21426254j]]
Hope this helps.
        bconsolvo
        
- 21
 - 5