swapnil jariwala
swapnil jariwala

Reputation: 1074

numpy build with mingw fails on Window with AttributeError: Mingw32CCompiler instance has no attribute 'compile_options', How to resolve this?

I've downloaded the numpy source from git-hub, I also have mingw installed and all the paths set on Windows, I can compile C files with mingw just fine so this is also working.
I'm following instructions on scipy website, with
python.exe setup.py config --compiler=mingw32 build --compiler=mingw32 bdist_wininst
It compiles for a while and then suddenly stops with this-

gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Inumpy\core\src\private -Inu
mpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\python27\include -IC:\python27\PC -c _configtest.c -o _configtest.o
_configtest.c: In function 'main':
_configtest.c:7:12: error: 'Py_UNICODE_WIDE' undeclared (first use in this function)
     (void) Py_UNICODE_WIDE;
            ^~~~~~~~~~~~~~~

_configtest.c:7:12: note: each undeclared identifier is reported only once for each function it appears in failure.
removing: _configtest.c _configtest.o
.
.
.
.
  File "D:\pylibs\numpy-master\numpy\distutils\command\build_src.py", line 386, in generate_sources
    source = func(extension, build_dir)
  File "numpy\core\setup.py", line 443, in generate_config_h
    rep = check_long_double_representation(config_cmd)
  File "numpy\core\setup_common.py", line 194, in check_long_double_representation
    cmd.compiler.compile_options.remove("/GL")
AttributeError: Mingw32CCompiler instance has no attribute 'compile_options'

How to resolve this please?

Upvotes: 0

Views: 780

Answers (1)

In your distribution, add the following code at line 194 of file numpy\core\setup_common.py and rebuild. It should allow you to build.

    except AttributeError:
        pass

Upvotes: 1

Related Questions