简体   繁体   English

无法在gitlab-ci上设置“ sphinx”

[英]Unable to setup “sphinx” on gitlab-ci

Unable to setup sphinx on gitlab-ci 无法在gitlab-ci上设置Sphinx

I'm trying to setup and run sphnix on gitlab-ci. 我正在尝试在gitlab-ci上设置并运行sphnix。 It's installed on my local machine and server works fine. 它已安装在我的本地计算机上,并且服务器工作正常。 But not at gitlab-ci 但不是gitlab-ci

Here's a part of my gitlab-ci: 这是我的gitlab-ci的一部分:

  before_script:
    - apt-get update -qq && apt-get install -yqq [......] python-pip
    - pip install sphinx

    # ..........
    - bundle exec rake ts:index
    - bundle exec rake ts:start

The output of installing sphinx: 安装狮身人面像的输出:

$ pip install sphinx
Downloading/unpacking sphinx
[................]
Installing collected packages: sphinx, babel, [.............]
Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py ...
  File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py", line 7
    async def auto_to_seq(value):
            ^
SyntaxError: invalid syntax

Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py ...
  File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py", line 22
    async def concat_async(async_gen):
            ^
SyntaxError: invalid syntax

  Running setup.py install for MarkupSafe

    building 'markupsafe._speedups' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
    markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.


    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
    ==========================================================================
Successfully installed sphinx babel sphinxcontrib-websupport Jinja2 alabaster imagesize Pygments snowballstemmer docutils packaging typing pytz MarkupSafe pyparsing
Cleaning up...

As you can see, it's successeded. 如您所见,它已经成功。

However, when it gets to this point, it fails: 但是,到了这一点,它就会失败:

  $ bundle exec rake ts:index
  Generating configuration to /builds/my_user/my_ap123/config/test.sphinx.conf
  sh: 1: indexer: not found

  The Sphinx indexing command failed:
    Command: indexer --config "/builds/my_user/my_ap123/config/test.sphinx.conf" --all
    Status:  127
    Output:  See above

Why is that? 这是为什么? How to fix it? 如何解决?

pip install sphinx did not fully succeed. pip install sphinx没有完全成功。 during installation, it is complaining about missing Python.h 在安装过程中,它抱怨缺少Python.h

fatal error: Python.h: No such file or directory 致命错误:Python.h:没有这样的文件或目录

You need to install a development package of python as well. 您还需要安装python开发包。 For python3x use 对于python3x使用

sudo apt-get install python3-dev

For python2x use 对于python2x使用

sudo apt-get install python-dev

You can add it to before_script 您可以将其添加到before_script

before_script:
    - apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev
    - pip install sphinx

Update : 更新

To install sphinx search engine using gitlab ci update your before_script as follow 要使用gitlab ci安装sphinx搜索引擎,请按照以下步骤更新before_script

before_script:
    - add-apt-repository ppa:builds/sphinxsearch-rel22 sphinxsearch
    - apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev mysql-client unixodbc libpq5 
    - pip install sphinxsearch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM