Repository: numpy/numpy

Issue:
[BUG] Intel Fortran compiler installed but not found
Hi,
I have intel compilers installed, but get this:
```
Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler
Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort
Traceback (most recent call last):
File "setup.py", line 418, in <module>setup_package()
File "setup.py", line 414, in setup_packagesetup(**metadata)
File "/usr/lib/python3.6/site-packages/numpy/distutils/core.py", line 169, in setupreturn old_setup(**new_attr)
File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setupreturn distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setupdist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commandsself.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run()
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_clib.py", line 75, in runself.run_command('build_src')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run()
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 148, in runself.build_sources()
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 165, in build_sourcesself.build_extension_sources(ext)
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 324, in build_extension_sourcessources = self.generate_sources(sources, ext)
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 377, in generate_sourcessource = func(extension, build_dir)
File "scipy/_lib/setup.py", line 32, in get_messagestream_configif config_cmd.check_func('open_memstream', decl=True, call=True):
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 312, in check_funcself._check_compiler()
File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 83, in _check_compilerself.fcompiler.customize(self.distribution)
File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 499, in customizeget_flags('opt', oflags)
File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 490, in get_flagsflags.extend(getattr(self.flag_vars, tag))
File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 39, in __getattr__return self._get_var(name, conf_desc)
File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 53, in _get_varvar = self._hook_handler(name, hook)
File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 697, in _environment_hookreturn hook()
File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/intel.py", line 125, in get_flags_optv = self.get_version()
File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 430, in get_versionraise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound
```


Discussion:
Hmm, looks like a bug. Did you use a `site.cfg`? And what build command did you use?
My NumPy 1.14 was build by this: https://aur.archlinux.org/cgit/aur.git/tree/?h=python-numpy-mkl
Then, I tried to build [SciPy with MKL](https://aur.archlinux.org/cgit/aur.git/tree/?h=python-scipy-mkl) and got that error

But the same error raises when I import `distutils` and try get the version manually.
Probably due to a mismatch between where MKL was located for the numpy build:

    library_dirs = /opt/intel/mkl/lib/intel64/ 
    include_dirs = /opt/intel/mkl/include 

and the scipy build:

    Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler
    Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort

Still a bug, but if you move your MKL install or create a symlink from `/opt/intel/mkl/` I expect the build to succeed.
I'll try this.
Seems the problem has long roots: https://github.com/numpy/numpy/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3A"component%3A+numpy.distutils"+
@homocomputeris 
Any results so far? Surprisingly, I have exactly the same problem now, however, I managed to build it successfully earlier. The only thing that has changed is icc version.  
@V-Kh Not really. I believe I eventually managed to compile it, but it should have been a happy coincidence of config and a proper MKL installation.

I avoided the problem by using GCC.
@homocomputeris OK, we're lucky enough: there is a new release available: https://aur.archlinux.org/cgit/aur.git/commit/?h=python-scipy-mkl&id=f749ab88426dc943806eb5442ec539c7e5d2ade0 

UPD. there is no need to rush, the problem is still there :-/ 

Resolving patch:
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -639,7 +639,7 @@ def matcher(version_string):
             return version
 
     try:
-        output = subprocess.check_output(version_cmd)
+        output = subprocess.check_output(version_cmd, stderr=subprocess.STDOUT)
     except subprocess.CalledProcessError as exc:
         output = exc.output
         status = exc.returncode


Test patch: