首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在码头安装nmslib

无法在码头安装nmslib
EN

Stack Overflow用户
提问于 2018-11-30 01:19:09
回答 1查看 1.1K关注 0票数 2

我不能在码头上使用nmslib安装pip

这是我的Dockerfile:

代码语言:javascript
复制
FROM continuumio/anaconda3:4.4.0
MAINTAINER UNP, https://unp.education
EXPOSE 8000
RUN apt-get update && apt-get install -y apache2 \
    apache2-dev \
    emacs \
 && apt-get clean \
 && apt-get autoremove \
 && rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/devise-api/
COPY ./devise-api.wsgi /var/www/devise-api/devise-api.wsgi
COPY ./devise-api /var/www/devise-api/
RUN pip install -r requirements.txt
RUN /opt/conda/bin/mod_wsgi-express install-module
RUN mod_wsgi-express setup-server devise-api.wsgi --port=8000 \
    --user www-data --group www-data \
    --server-root=/etc/mod_wsgi-express-80
CMD /etc/mod_wsgi-express-80/apachectl start -D FOREGROUND

目前,requirements.txt只包含单词nmslib

这是我在运行sudo docker build -t devise-api .时得到的输出

代码语言:javascript
复制
Sending build context to Docker daemon  306.2MB
Step 1/11 : FROM continuumio/anaconda3:4.4.0
 ---> 795ad88c47ff
Step 2/11 : MAINTAINER UNP, https://unp.education
 ---> Using cache
 ---> cd5b1f7e6188
Step 3/11 : EXPOSE 8000
 ---> Using cache
 ---> 21ad868f0823
Step 4/11 : RUN apt-get update && apt-get install -y apache2     apache2-dev     emacs  && apt-get clean  && apt-get autoremove  && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> ebfc7c30b394
Step 5/11 : WORKDIR /var/www/devise-api/
 ---> Using cache
 ---> 8228e4b4d4fd
Step 6/11 : COPY ./devise-api.wsgi /var/www/devise-api/devise-api.wsgi
 ---> Using cache
 ---> c8cf5cfcf7dc
Step 7/11 : COPY ./devise-api /var/www/devise-api/
 ---> Using cache
 ---> 856e67f0b1de
Step 8/11 : RUN pip install -r requirements.txt
 ---> Running in 7260901af476
Collecting nmslib (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/e1/95/1f7c90d682b79398c5ee3f9296be8d2640fa41de24226bcf5473c801ada6/nmslib-1.7.3.6.tar.gz (255kB)
Collecting pybind11>=2.0 (from nmslib->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/f2/7c/e71995e59e108799800cb0fce6c4b4927914d7eada0723dd20bae3b51786/pybind11-2.2.4-py2.py3-none-any.whl (145kB)
Requirement already satisfied: numpy in /opt/conda/lib/python3.6/site-packages (from nmslib->-r requirements.txt (line 1))
Building wheels for collected packages: nmslib
  Running setup.py bdist_wheel for nmslib: started
  Running setup.py bdist_wheel for nmslib: finished with status 'error'
  Complete output from command /opt/conda/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4qfop8hr/nmslib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpl9tnakclpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  creating tmp
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/include/python3.6m -c /tmp/tmp2pnwck3x.cpp -o tmp/tmp2pnwck3x.o -std=c++14
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/include/python3.6m -c /tmp/tmp5ktoxd0l.cpp -o tmp/tmp5ktoxd0l.o -fvisibility=hidden
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  building 'nmslib' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/nmslib
  creating build/temp.linux-x86_64-3.6/nmslib/similarity_search
  creating build/temp.linux-x86_64-3.6/nmslib/similarity_search/src
  creating build/temp.linux-x86_64-3.6/nmslib/similarity_search/src/space
  creating build/temp.linux-x86_64-3.6/nmslib/similarity_search/src/method
  gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./nmslib/similarity_search/include -I/opt/conda/include/python3.6m -I/root/.local/include/python3.6m -I/opt/conda/lib/python3.6/site-packages/numpy/core/include -I/opt/conda/include/python3.6m -c nmslib.cc -o build/temp.linux-x86_64-3.6/nmslib.o -O3 -march=native -fopenmp -DVERSION_INFO="1.7.3.6" -std=c++14 -fvisibility=hidden
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  nmslib.cc:16:31: fatal error: pybind11/pybind11.h: No such file or directory
   #include <pybind11/pybind11.h>
                                 ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for nmslib
  Running setup.py clean for nmslib
Failed to build nmslib
Installing collected packages: pybind11, nmslib
  Running setup.py install for nmslib: started

那它永远都是这样的。有人知道我能想办法解决这个问题吗?

提前谢谢你!

诚挚的问候

F

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-26 08:11:18

我只是面对同样的问题,在安装RUN之前添加了nmslib步骤来修正它。

代码语言:javascript
复制
RUN pip install pip==9.0.3 pybind11

见:https://github.com/nmslib/nmslib/issues/307#issuecomment-384113900。希望这对你的情况也有帮助:)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53549896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档