Faiss: Make py -- SyntaxError: invalid syntax

Created on 9 May 2019  路  5Comments  路  Source: facebookresearch/faiss

when I run "make py", the following error appears

make[1]: Entering directory 'path_to/faiss/python'
python -c++ -Doverride= -I../ -DGPU_WRAPPER -o swigfaiss.cpp swigfaiss.swig
  File "<string>", line 1
    ++
     ^
SyntaxError: invalid syntax
Makefile:17: recipe for target 'swigfaiss.cpp' failed
make[1]: [swigfaiss.cpp] Error 1 (ignored)
g++ -std=c++11 -DFINTEGER=int  -fopenmp -I/usr/local/cuda-10.0/include  -fPIC -m64 -Wno-sign-compare -g -O3 -Wall -Wextra -msse4 -mpopcnt -I \
               -I../ -c swigfaiss.cpp -o swigfaiss.o
g++: error: swigfaiss.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
Makefile:20: recipe for target 'swigfaiss.o' failed
make[1]: *** [swigfaiss.o] Error 1
make[1]: Leaving directory '/opt/Faiss/faiss/python'
Makefile:82: recipe for target 'py' failed
make: *** [py] Error 2

Env

OS: Ubuntu 18.04.2 LTS
Faiss version: up to date with 'origin/master'
Running on:

  • [ ] CPU
  • [x] GPU
    Interface:
  • [x] C++
  • [x] Python

Previous steps done:


swig -version
SWIG Version 4.0.0

Compiled with g++ [x86_64-pc-linux-gnu]

$ ./configure --with-cuda=/usr/local/cuda-10.0 --with-python=/usr/bin/python3

./configure --with-cuda=/usr/local/cuda-10.0  --with-python=/usr/bin/python3
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ supports C++11 features with -std=c++11... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for /usr/bin/python3... no
checking for Python C flags... ./configure: line 4138: -c: command not found

checking for swig... no
checking how to run the C++ preprocessor... g++ -std=c++11 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for nvcc... /usr/local/cuda-10.0/bin/nvcc
checking cuda.h usability... yes
checking cuda.h presence... yes
checking for cuda.h... yes
checking for cublasAlloc in -lcublas... yes
checking for cudaSetDevice in -lcudart... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for stdbool.h that conforms to C99... no
checking for _Bool... no
checking for inline... inline
checking for int32_t... yes
checking for int64_t... yes
checking for C/C++ restrict keyword... __restrict
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for clock_gettime... yes
checking for floor... yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for munmap... yes
checking for pow... yes
checking for sqrt... yes
checking for strerror... yes
checking for strstr... yes
checking for g++ -std=c++11 option to support OpenMP... -fopenmp
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking if sgemm_ is being linked in already... no
checking for sgemm_ in -lmkl_intel_lp64... no
checking for sgemm_ in -lmkl... no
checking for sgemm_ in -lopenblas... yes
checking for cheev_... yes
checking target system type... x86_64-pc-linux-gnu
checking for cpu arch... x86_64-pc-linux-gnu CPUFLAGS+=-msse4 -mpopcnt CXXFLAGS+=-m64
configure: creating ./config.status
config.status: creating makefile.inc

$ make
$ make install

install question

All 5 comments

the first line show some flag var are wrong
the second line show swig is not installed.

I also fail when making py.

../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
swigfaiss.swig:301: Warning 302: Identifier 'IndexShards' redefined (ignored) (Renamed from 'IndexShardsTemplate< faiss::Index >'),
../IndexShards.h:79: Warning 302: previous definition of 'IndexShards'.
swigfaiss.swig:302: Warning 302: Identifier 'IndexBinaryShards' redefined (ignored) (Renamed from 'IndexShardsTemplate< faiss::IndexBinary >'),
../IndexShards.h:80: Warning 302: previous definition of 'IndexBinaryShards'.
swigfaiss.swig:305: Warning 302: Identifier 'IndexReplicas' redefined (ignored) (Renamed from 'IndexReplicasTemplate< faiss::Index >'),
../IndexReplicas.h:86: Warning 302: previous definition of 'IndexReplicas'.
swigfaiss.swig:306: Warning 302: Identifier 'IndexBinaryReplicas' redefined (ignored) (Renamed from 'IndexReplicasTemplate< faiss::IndexBinary >'),
../IndexReplicas.h:87: Warning 302: previous definition of 'IndexBinaryReplicas'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../IndexBinary.h:38: Warning 315: Nothing known about 'Index::idx_t'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../IndexBinary.h:38: Warning 315: Nothing known about 'Index::idx_t'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../IndexBinary.h:38: Warning 315: Nothing known about 'Index::idx_t'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../IndexBinary.h:38: Warning 315: Nothing known about 'Index::idx_t'.
../Index.h:63: Warning 315: Nothing known about 'long'.
../IndexBinary.h:38: Warning 315: Nothing known about 'Index::idx_t'.

this warning lead to the idx_t undefined when compile the swigfaiss.cpp.
when I try to explicit typedefine idx_t, it still get error about other undefine functions.Needing help

@hanhfgia Swig does not seem to be in your path.

@Santiago810 Would you mind opening a separate issue?

@hanhfgia Swig does not seem to be in your path.

Thanks, reload env missed :). It's done

@hanhfgia Swig does not seem to be in your path.

Thanks, reload env missed :). It's done

Excuse me, What's the Path which i need to join in?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ljferrer picture Ljferrer  路  3Comments

cherryPotter picture cherryPotter  路  3Comments

linghuang picture linghuang  路  3Comments

minjiaz picture minjiaz  路  3Comments

brunodoamaral picture brunodoamaral  路  3Comments