fairseq/clib/libbleu/libbleu.cpp:10:10: fatal error: 'array' file not found

Created on 2 Apr 2018  路  3Comments  路  Source: pytorch/fairseq

I have successfully installed pytorch 0.4.0. on mac.

import torch
print(torch.__version__)
0.4.0a0+0b17f4b

But I got an error when I type "python setup.py build". How to fix it?
running build
running build_py
running build_ext
building 'fairseq.libbleu' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/q/anaconda/envs/python36/include -arch x86_64 -I/Users/q/anaconda/envs/python36/include -arch x86_64 -I/Users/q/anaconda/envs/python36/include/python3.6m -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.macosx-10.7-x86_64-3.6/fairseq/clib/libbleu/libbleu.o -std=c++11
fairseq/clib/libbleu/libbleu.cpp:10:10: fatal error: 'array' file not found

include

     ^

1 error generated.
error: command 'gcc' failed with exit status 1

Most helpful comment

This happened for me when running pip install fairseq on my Mac. I ran export CFLAGS='-stdlib=libc++ and then pip install fairseq completed successfully.

All 3 comments

Fixed. Added '-mmacosx-version-min=10.11' to extra_compile_args in setup.py.
extra_compile_args=['-std=c++11', '-mmacosx-version-min=10.11'],

Still encountered error on my mac

changing `libbleu.cppp'

#include <array> => #include <tr1/array> fixed it for me

This happened for me when running pip install fairseq on my Mac. I ran export CFLAGS='-stdlib=libc++ and then pip install fairseq completed successfully.

Was this page helpful?
0 / 5 - 0 ratings