Unable to build scipy with mkl on ubuntu 12.04

Unable to build scipy with mkl on ubuntu 12.04


I am trying to build numpy and scipy on 64-bit Ubuntu 12.04 with Intel MKL.

I have installed all the prerequisites. The INTEL C++ complier and the Fortran compiler verision are all 2011 sp1 10.319 and MKL is the version within it.

I am following the installation instruction fromINTEL's website.

I have successfully build and installed numpy.

When building scipy I encounted the problem as follows:

error: could note create '/usr/local/lib/python2.7/dist-packages/scipy': Permission denied

when I try to put sudo in front of the install line, I got:

numpy.distutils.fcompiler.CompilerNotFound: intelem: f90 nor f77

Could anyone help me?


8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Aurora1625,

Do you mean you got the error at the step with the command

Compile and install SciPy with the Intel Compilers: (On 64-bit platforms replace "intel" with "intelem") - collapse sourceview plaincopy to clipboardprint?

sodu $pythonsetup.pyconfig--compiler=intel--fcompiler=intelbuild_clib--compiler=intel--fcompiler=intelbuild_ext--compiler=intel--fcompiler=intelinstall

Best Regards,

Can you also find the Intel Fotran compiler in your PATH?


Hey I have the same issue:

I am trying to install Numpy/Scipy with the instructions given on this webpage: http://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl .

So the site.cfg file and the intel.py files have been modified according to the specifications given by the webpage.

I encounter the same issue on installing Numpy and Scipy:

When installing Numpy with the command given:

sudo python setup.py config --compiler=intelem build_clib --compiler=intelem build_ext --compiler=intelem install

the installation process seams to work well until this error shows up:

creating /usr/local/lib/python2.7/dist-packages/numpy
error: could not create '/usr/local/lib/python2.7/dist-packages/numpy': Permission denied

So I passed the command as a super user:

sudo python setup.py config --compiler=intelem build_clib --compiler=intelem build_ext --compiler=intelem install

but now there is another error:

compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/include/python2.7 -c'
icc: _configtest.c
sh: 1: icc: not found
sh: 1: icc: not found
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "setup.py", line 214, in
File "setup.py", line 207, in setup_package
configuration=configuration )
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/core.py", line 186, in setup
return old_setup(**new_attr)
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/command/build_clib.py", line 62, in run
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/command/build_src.py", line 152, in run
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/command/build_src.py", line 163, in build_sources
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/command/build_src.py", line 298, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/home/pierre/Téléchargements/numpy-1.6.2/numpy/distutils/command/build_src.py", line 385, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 696, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program

Note that this output indicates that icc cannot be found, but it is well installed on the computer and in the PATH environment variable and without the super user things seems to compile...

The same issue comes up with scipy, the files cannot be copied to /usr/local/lib/python2.7/dist-packages/ (I guess this is what the sciprt intend to do) because of denied permission.
But when I pass the install command in super user mode I get this error:

numpy.distutils.fcompiler.CompilerNotFound: intelem: f90 nor f77

Though icc and ifort is installed, and in use, because when I execute the install command as normal user I can see everything compiling!

It seems that everything is compiled and ready to use but when the installed script tries to copy the compiled files to the shared python modules in /usr/local/lib/python2.7/dist-packages/ it needs super user permission.
And apparently when running the command as super user the compilers can't be no longer found.

System decription:
HP Z800 workstation with Intel® Xeon(R) CPU X5675 @ 3.07GHz × 12
Running on Ubuntu 12.04
icc -> composer_xe_2011_sp1.10.319
ifort -> composer_xe_2011_sp1.9.293
MKL -> composer_xe_2011_sp1.11.339
Running the command ifort and icc show that they are indeed installed.

I am ready to give you any information you need about the system used if you need it!

Thank you for your help!

HI Pierre,

I saw you have shared some comments under the article

is the problem resolved by yourself?

Best Regards,

On Xubuntu 12.10, this issue is solved by linking ifort and icc in /usr/bin. Apparently, as @Pierre noticed, these files can't be found by the root account when you do "sudo python setup.py config ..." since they're usually installed to /opt. But the root account does look at /usr/bin, so put the links there. 

As your sudo command opens a new shell, you would need to set the same compiler environment in that shell as in your user shell, in order to build normally.


I summarize the issue here so more users may clear about the problem: 

The error "Permission denied" because non-super user.  if use 
>sudo python setup.py config --compiler=intelem build_clib --compiler=intelem build_ext --compiler=intelem install

icc/ifort environment can be set up  because sudo don't recognize the 'source source /opt/intel/composer_xe_2013_sp1.2.144/bin/iccvars.sh intel64". 

So user can use root to build the numpy and scipy if possible. 

Or either Pierre's solution 

cipy should be done in two steps:
First to build (with intelem instead of intel for 64 bits processors):
python setup.py config --compiler=intel build_clib --compiler=intel build_ext --compiler=intel
Then install:
sudo python setup.py install

Same for Scipy.

or Ethan's solution: 

inking ifort and icc in /usr/bin

Best Regards,


Leave a Comment

Please sign in to add a comment. Not a member? Join today