1

I'm trying to install a python script that my colleagues built years ago in my computer. When I run

python setup.py install

I run into the problem "No module named 'numpy.distutils._msvccompiler'"

No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.

building 'grid' extension
compiling C sources
error: Unable to find vcvarsall.bat

I've seen this problem around the webpage several times, but no one seems to fully solve the issue. Some details that may be relevant from what I've read around:

  • I'm using anaconda on windows, while the script was developed on ubuntu.
  • I tried installing the script in ubuntu and I didn't have problems.
  • I've seen microsoft VS mentioned several times. I don't have VS installed. I do have VS code but I think that's irrelevant.

I thought it may be related to some package, so I looked for packages containing msvc in anaconda and installed msvc_runtime. It didn't change the error, so I uninstalled it back.

I've seen an answer (statsmodels installation: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils) where they mentioned the MS C++ compilers. I checked the ones I have installed, and they are 2010, 2012, 2013, 2017.

By default, Anaconda comes with vs2015_runtime installed. Since I have no C++2015 and anaconda by default comes with vs2015_runtime installed, I tried installing C++2015 manually. I get the error that it is already installed, while is not: C++ 2015 won't install I then tried installing vs2013_runtime in anaconda and that won't solve the problem. I uninstalled it. I then tried uninstalling vs2015 from anaconda, but it is a critical package and it won't uninstall.

I've read this answer https://github.com/stan-dev/pystan/issues/306 (specially the last message where the user summarizes the steps) since "msvccompiler" is mentioned there, but I think the issue they are facing is different.

I'm out of ideas. Thank you for reading!

Melvin Moreno
  • 13
  • 1
  • 4

1 Answers1

2

I was struggling with that problem also. I was trying to compile a C file. It did work for Python 2.7 (Anaconda 2 in Windows 2012 Server) but for Python 3.7 I was having the same problem you reported. I solved the problem installing the Visual Studio Build Tools 2017. As soon I installed it the problem disappear, and the compilation worked. Look at (https://wiki.python.org/moin/WindowsCompilers)

Hope this help.

Dariva
  • 330
  • 2
  • 13