【发布时间】:2020-04-15 20:58:41
【问题描述】:
我一直在尝试在 docker 容器中安装 fasttext。在尝试了许多预安装后,我遇到了同样的错误。
本质上,我在 windows 中有相同的代码,我通过 PyCharm 中的 pip 安装。它可以正常工作。我认为在基于 Linux 的系统中,它会更容易。但是,我无法摆脱安装问题。
这里是错误sn-p:
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=hidden
python/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 memory
error: command 'gcc' failed with exit status 1
The command '/bin/sh -c cd fastText && python setup.py install' returned a non-zero code: 1
我的码头集装箱:
FROM python:3.7.4
WORKDIR /app
ADD . /app
# Install any necessary dependencies
RUN pip3 install --upgrade setuptools pip
RUN apt-get update && apt-get install
RUN apt install -y libprotobuf-dev protobuf-compiler
RUN python -m pip install --user numpy scipy
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get install -y build-essential -y gcc-7
RUN apt-get -y install make
RUN apt-get -qq -y install python3-dev
RUN pip3 install pybind11
RUN pip3 install --upgrade cython
RUN git clone https://github.com/facebookresearch/fastText.git
RUN cd fastText && python setup.py install
RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
我错过了什么吗?前置要求指定为:
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.
我尝试通过 pip3 安装 Numpy 和 sCipy,各种 gcc 版本,仅通过 pip install fasttext 安装 fasttext 等。到目前为止没有任何效果。
有人可以帮忙解决这个错误吗?
【问题讨论】:
标签: python-3.x gcc fasttext