I have been trying to install fasttext in a docker container. I am getting the same error after trying many pre-installations.
Essentially, I have the same code in windows and I installed via pip in PyCharm. It works without any problem. I thought in Linux based systems, it would be easier. However, I could not get rid of the installation problem.
Here is the error snippet:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/lib/python3.7/site-packages/pybind11/include - I/usr/local/lib/python3.7/site-packages/pybind11/include -Isrc - I/usr/local/include/python3.7m -c python/fasttext_module/fasttext/pybind/fasttext_pybind.cc -o build/temp.linux-x86_64- 3.7/python/fasttext_module/fasttext/pybind/fasttext_pybind.o - DVERSION_INFO="0.9.1" -std=c++14 -fvisibility=hiddenpython/fasttext_module/fasttext/pybind/fasttext_pybind.cc: In lambda function:python/fasttext_module/fasttext/pybind/fasttext_pybind.cc:296:35: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::vector<long int>::size_type’ {aka ‘long unsigned int’} [- Wsign-compare] for (int32_t i = 0; i < vocab_freq.size(); i++) { ~~^~~~~~~~~~~~~~~~~~~python/fasttext_module/fasttext/pybind/fasttext_pybind.cc: In lambda function:python/fasttext_module/fasttext/pybind/fasttext_pybind.cc:310:35: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘std::vector<long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] for (int32_t i = 0; i < labels_freq.size(); i++) { ~~^~~~~~~~~~~~~~~~~~~~virtual memory exhausted: Cannot allocate memoryerror: command 'gcc' failed with exit status 1The command '/bin/sh -c cd fastText && python setup.py install' returned a non-zero code: 1
My docker container:
FROM python:3.7.4WORKDIR /appADD . /app# Install any necessary dependenciesRUN pip3 install --upgrade setuptools pipRUN apt-get update && apt-get installRUN apt install -y libprotobuf-dev protobuf-compilerRUN python -m pip install --user numpy scipyRUN apt-get install -y software-properties-commonRUN add-apt-repository ppa:ubuntu-toolchain-r/testRUN apt-get install -y build-essential -y gcc-7RUN apt-get -y install makeRUN apt-get -qq -y install python3-devRUN pip3 install pybind11RUN pip3 install --upgrade cythonRUN git clone https://github.com/facebookresearch/fastText.gitRUN cd fastText && python setup.py installRUN pip3 install --trusted-host pypi.python.org -r requirements.txt
Am I missing something? The pre-requirements are specified as:
fastText builds on modern Mac OS and Linux distributions. Since it uses C++11 features, it requires a compiler with good C++11 support. You will need Python (version 2.7 or ≥ 3.4), NumPy & SciPy and pybind11.
I have tried installing Numpy and sCipy via pip3, various gcc versions, install fasttext via only pip install fasttext
etc. Nothing worked so far.
Can someone help with this error, please?