epfml / sent2vec

General purpose unsupervised sentence representations
Other
1.19k stars 256 forks source link

No module named Cython.Build #34

Closed sxhmilyoyo closed 6 years ago

sxhmilyoyo commented 6 years ago

When I run sudo pip install . in src folder after running python setup.py build_ext, I got the following error:

Running setup.py (path:/tmp/pip-IRGssa-build/setup.py) egg_info for package from file:///home/hao/Workplace/HaoXu/Library/sent2vec/src
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-IRGssa-build/setup.py", line 2, in <module>
        from Cython.Build import cythonize
    ImportError: No module named Cython.Build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip-IRGssa-build/setup.py", line 2, in <module>

    from Cython.Build import cythonize

ImportError: No module named Cython.Build

When I run python setup.py build_ext, I got the following warning:

Compiling sent2vec.pyx because it changed.
[1/1] Cythonizing sent2vec.pyx
running build_ext
building 'sent2vec' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c sent2vec.cpp -o build/temp.linux-x86_64-3.6/sent2vec.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c fasttext.cc -o build/temp.linux-x86_64-3.6/fasttext.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
fasttext.cc: In member function ‘void fasttext::FastText::findNNSent(const fasttext::Matrix&, const fasttext::Vector&, int32_t, const std::set<std::__cxx11::basic_string<char> >&, int64_t, const std::vector<std::__cxx11::basic_string<char> >&)’:
fasttext.cc:587:10: warning: variable ‘it’ set but not used [-Wunused-but-set-variable]
     auto it = banSet.find(heap.top().second);
          ^
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c args.cc -o build/temp.linux-x86_64-3.6/args.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c dictionary.cc -o build/temp.linux-x86_64-3.6/dictionary.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c matrix.cc -o build/temp.linux-x86_64-3.6/matrix.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c qmatrix.cc -o build/temp.linux-x86_64-3.6/qmatrix.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c model.cc -o build/temp.linux-x86_64-3.6/model.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c real.cc -o build/temp.linux-x86_64-3.6/real.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c utils.cc -o build/temp.linux-x86_64-3.6/utils.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c vector.cc -o build/temp.linux-x86_64-3.6/vector.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c real.cc -o build/temp.linux-x86_64-3.6/real.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/sunday/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/sunday/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/include -I/home/sunday/anaconda3/envs/py36/include/python3.6m -c productquantizer.cc -o build/temp.linux-x86_64-3.6/productquantizer.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
creating build/lib.linux-x86_64-3.6
g++ -pthread -shared -B /home/sunday/anaconda3/envs/py36/compiler_compat -L/home/sunday/anaconda3/envs/py36/lib -Wl,-rpath=/home/sunday/anaconda3/envs/py36/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/sent2vec.o build/temp.linux-x86_64-3.6/fasttext.o build/temp.linux-x86_64-3.6/args.o build/temp.linux-x86_64-3.6/dictionary.o build/temp.linux-x86_64-3.6/matrix.o build/temp.linux-x86_64-3.6/qmatrix.o build/temp.linux-x86_64-3.6/model.o build/temp.linux-x86_64-3.6/real.o build/temp.linux-x86_64-3.6/utils.o build/temp.linux-x86_64-3.6/vector.o build/temp.linux-x86_64-3.6/real.o build/temp.linux-x86_64-3.6/productquantizer.o -o build/lib.linux-x86_64-3.6/sent2vec.cpython-36m-x86_64-linux-gnu.so

Python version: Python 3.6.6 GCC: 7.2.0

mpagli commented 6 years ago

What is your system and did you try upgrading cython: pip install --upgrade cython ?

sxhmilyoyo commented 6 years ago

@mpagli System info: Ubuntu 14.04.5 LTS. and I installed the latest cython-0.28.3. I am not sure my installation steps are correct. First I run make, then in the src folder, I run python setup.py build_ext and sudo pip install .. Thanks.

sxhmilyoyo commented 6 years ago

@mpagli I solved the issue. It turns out that when I use sudo pip install ., it uses default pip instead of my anaconda version. I used pip install . instead, it worked. I am sorry to bother you.

mpagli commented 6 years ago

No worries, glad you fixed your issue :)

Crescentz commented 5 years ago

cc1plus: warning

sorry , i also have the same problem

Crescentz commented 5 years ago

pare cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/zy/miniconda3/envs/py37key/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/zy/miniconda3/envs/py37key/lib/python3.7/site-packages/numpy/core/include -I/home/zy/miniconda3/envs/py37key/include/python3.7m -c vector.cc -o build/temp.linux-x86_64-3.7/vector.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/zy/miniconda3/envs/py37key/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/zy/miniconda3/envs/py37key/lib/python3.7/site-packages/numpy/core/include -I/home/zy/miniconda3/envs/py37key/include/python3.7m -c real.cc -o build/temp.linux-x86_64-3.7/real.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/zy/miniconda3/envs/py37key/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/zy/miniconda3/envs/py37key/lib/python3.7/site-packages/numpy/core/include -I/home/zy/miniconda3/envs/py37key/include/python3.7m -c productquantizer.cc -o build/temp.linux-x86_64-3.7/productquantizer.o -std=c++0x -Wno-cpp -pthread -Wno-sign-compare cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ creating build/lib.linux-x86_64-3.7

mpagli commented 5 years ago

which command are you using?

Crescentz commented 5 years ago

Environment:Ubuntu 16.04.4 LTS python3.7 when i running '''python setup.py build_ext'''

mpagli commented 5 years ago

if you pulled the latest version of the code you just need to run pip install . --upgrade. If it has been generated already, remove the sent2vec.cpp from the src folder.