circleci:pip安装dlib失败 [英] circleci: pip install dlib fails

查看:129
本文介绍了circleci:pip安装dlib失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要 dlib 的python项目。我正在尝试设置CircleCI并按如下所示编写我的 config.yml

I have a python project that requires dlib. I am trying to setup CircleCI and wrote my config.yml as follows:

# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python:3.6.1

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "requirements.txt" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run:
          name: install dlib
          command: |
            sudo apt-get update
            sudo apt-get install build-essential cmake pkg-config
            sudo apt-get install libatlas-base-dev
            sudo apt-get install libgtk-3-dev libboost-python-dev
            sudo apt-get install libopenblas-dev liblapack-dev
            sudo apt-get install libboost-all-dev
            sudo apt-get install libx11-dev libgtk-3-dev
            sudo apt-get install python python-dev python-pip
            sudo apt-get install python3 python3-dev python3-pip

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements.txt

      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}

requirements.txt 里面有 dlib 。但是,当我将其推送到GitHub以运行CI时,会出现以下错误:

requirements.txt has dlib inside. However, when I push this to GitHub to run the CI, I get the following error:

Command "/home/circleci/repo/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-v87eln0u/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-gpf75fsu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/circleci/repo/venv/include/site/python3.6/dlib" failed with error code 1 in /tmp/pip-build-v87eln0u/dlib/

失败,错误代码为1追溯:

Here's the traceback:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "/home/circleci/repo/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/circleci/repo/venv/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 135, in run
        self.build_extension(ext)
      File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 175, in build_extension
        subprocess.check_call(cmake_build, cwd=build_folder)
      File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j34']' returned non-zero exit status 2.

似乎我没有在其中设置linux环境成功安装 dlib 的命令。我在这里想念什么?如何使用在Python上正确配置的 dlib 运行CircleCI?

It seems like I'm not setting the linux environment right in order for dlib to be installed successfully. What am I missing here? How can I run CircleCI with dlib properly configured on python?

推荐答案

您可以使用conda环境(在python 3.6至3.7.0正常工作的情况下)安装dlib。

You can install dlib using conda environment (with python 3.6 to 3.7.0 working normally).

首先创建一个环境, conda create -n env_name python = version

然后激活, conda激活env_name

现在通过conda forge频道, conda install -c conda-forge dlib = 19.17

now install via conda forge channel, conda install -c conda-forge dlib=19.17

这篇关于circleci:pip安装dlib失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆