Erlinska
Erlinska

Reputation: 433

AttributeError: 'MSVCCompiler' object has no attribute 'compiler' when trying to install a numpy extension

I'm having an issue when installing the numpy extension py_find_1st 1.1.3. When I try to install it via cmd on Windows, I get the following message:

D:\Chrome dl\py_find_1st-1.0.6\py_find_1st-1.0.6>python setup.py install
running install
running bdist_egg
running egg_info
writing top-level names to py_find_1st.egg-info\top_level.txt
writing dependency_links to py_find_1st.egg-info\dependency_links.txt
writing py_find_1st.egg-info\PKG-INFO
reading manifest file 'py_find_1st.egg-info\SOURCES.txt'
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Traceback (most recent call last):
  File "setup.py", line 117, in <module>
    zip_safe = False,
  File "D:\Anaconda\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Anaconda\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 67, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 109, in do_egg_install
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 161, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 147, in call_command
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install_lib.py", line 11, in run
  File "D:\Anaconda\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\distutils\command\build_ext.py", line 338, in run
    self.build_extensions()
  File "setup.py", line 42, in build_extensions
    if compiler_is_clang(self.compiler.compiler):
AttributeError: 'MSVCCompiler' object has no attribute 'compiler'

I have no knowledge of C or Fortran but if I understand it correctly, numpy extensions are often created using these languages. I was told that I might need a compiler installed on my computer and thus I installed Visual Studio 2017 but I still get the same message.

Does anybody know a way to successfully install this extension?

P.S: The "cl" command is recognized on the command prompt.

Upvotes: 1

Views: 6956

Answers (1)

Hagbard
Hagbard

Reputation: 3700

This is less of an answer and more of a heads up for people running into this in the future:

According to this link, "compiler is an attribute on [GNU/]Linux but not Windows." Thus, it's highly likely that something is wrong with the setup scripts whenever you run into this problem. Most probably, the package author didn't consider Windows installation routines and needs to be notified.

If you want to fix this yourself, I recommend looking for any line of your setup.py file containing the "self.compiler.compiler[0]" part and commenting it out.

Upvotes: 4

Related Questions