GitLab CI错误:无法为使用PEP 517的GLPK构建车轮,无法直接安装

发布于 2025-01-25 12:42:24 字数 4178 浏览 2 评论 0原文

我已经在本地安装了Windows机器GLPK并运行。但是,作为gitlab ci的一部分,当我推进gitlab时,我会收到以下错误:

  Building wheel for glpk (PEP 517): started
  Building wheel for glpk (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpr4_114h3
       cwd: /tmp/pip-install-dj24wr4l/glpk_fa702cebdf2c4db9a16294c1def2434d
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'glpk' extension
  creating build
  creating build/temp.linux-x86_64-cpython-38
  creating build/temp.linux-x86_64-cpython-38/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/2to3.c -o build/temp.linux-x86_64-cpython-38/src/2to3.o
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/bar.c -o build/temp.linux-x86_64-cpython-38/src/bar.o
  In file included from src/bar.h:24,
                   from src/bar.c:22:
  src/lp.h:24:10: fatal error: glpk.h: No such file or directory
     24 | #include <glpk.h>
        |          ^~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for glpk
  Building wheel for pymeeus (setup.py): started
  Building wheel for pymeeus (setup.py): finished with status 'done'
  Created wheel for pymeeus: filename=PyMeeus-0.5.11-py3-none-any.whl size=730985 sha256=1cab3ff9087153d2f105c80f95e88cf44ecf87a7489bef56745c268dfe038b8c
  Stored in directory: /root/.cache/pip/wheels/a0/8b/b2/810ae5a6f970c8be4725353400d643c90de1c0f023a9884ee7
Successfully built unipath django-crontab pymeeus
Failed to build glpk
ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1

我必须注意,我不记得我为制作glpk>在本地运行,我刚刚在我的unignts.txt文件中添加了glpk,但这显然不正确。在gitlab ci中,该怎么办?我必须在dockerfile中添加任何东西吗?

edit1:我的dockerfile是以下内容:

FROM registry.ubitech.eu/public-group/ubitech-public-registry/python:3.6

COPY manage.py gunicorn-cfg.py requirements.txt ./
COPY authentication authentication
COPY core core
COPY routers routers
COPY clustering clustering
COPY data_utilities data_utilities

RUN pip install -r requirements.txt

COPY cron_3.0pl1-137_amd64.deb ./
RUN dpkg -i cron_3.0pl1-137_amd64.deb

RUN mkdir logs
RUN touch logs/phoenix_dashboard.log

EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]

edit2:当我尝试提供解决方案时-for-for-glpk-wher-use-use-pep-517 and-cannot-be安装“>此处我正在遇到以下错误:

Step 8/15 : RUN apt install libglpk-dev python3.8-dev libgmp3-dev
 ---> Running in 0b141af248f9
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Package libgmp3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libgmp-dev
E: Unable to locate package libglpk-dev
E: Unable to locate package python3.8-dev
E: Couldn't find any package by glob 'python3.8-dev'
E: Package 'libgmp3-dev' has no installation candidate
The command '/bin/sh -c apt install libglpk-dev python3.8-dev libgmp3-dev' returned a non-zero code: 100
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1

I have installed in my windows machine locally glpk successfully and runs. However, as a part of Gitlab CI, when I push into Gitlab I am getting the following error:

  Building wheel for glpk (PEP 517): started
  Building wheel for glpk (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpr4_114h3
       cwd: /tmp/pip-install-dj24wr4l/glpk_fa702cebdf2c4db9a16294c1def2434d
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'glpk' extension
  creating build
  creating build/temp.linux-x86_64-cpython-38
  creating build/temp.linux-x86_64-cpython-38/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/2to3.c -o build/temp.linux-x86_64-cpython-38/src/2to3.o
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DVERSION_NUMBER=\"0.4.6\" -I/usr/local/include/python3.8 -c src/bar.c -o build/temp.linux-x86_64-cpython-38/src/bar.o
  In file included from src/bar.h:24,
                   from src/bar.c:22:
  src/lp.h:24:10: fatal error: glpk.h: No such file or directory
     24 | #include <glpk.h>
        |          ^~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for glpk
  Building wheel for pymeeus (setup.py): started
  Building wheel for pymeeus (setup.py): finished with status 'done'
  Created wheel for pymeeus: filename=PyMeeus-0.5.11-py3-none-any.whl size=730985 sha256=1cab3ff9087153d2f105c80f95e88cf44ecf87a7489bef56745c268dfe038b8c
  Stored in directory: /root/.cache/pip/wheels/a0/8b/b2/810ae5a6f970c8be4725353400d643c90de1c0f023a9884ee7
Successfully built unipath django-crontab pymeeus
Failed to build glpk
ERROR: Could not build wheels for glpk which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1

I have to note that I do not remember what I did to make glpk run locally and I just added glpk in my requirements.txt file, but this apparently is not correct. What should I do to bypass this error in Gitlab CI? Do I have to add anything in my Dockerfile?

EDIT1: My Dockerfile is the following:

FROM registry.ubitech.eu/public-group/ubitech-public-registry/python:3.6

COPY manage.py gunicorn-cfg.py requirements.txt ./
COPY authentication authentication
COPY core core
COPY routers routers
COPY clustering clustering
COPY data_utilities data_utilities

RUN pip install -r requirements.txt

COPY cron_3.0pl1-137_amd64.deb ./
RUN dpkg -i cron_3.0pl1-137_amd64.deb

RUN mkdir logs
RUN touch logs/phoenix_dashboard.log

EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]

EDIT2: When I am trying the solution provided here I am getting the following error:

Step 8/15 : RUN apt install libglpk-dev python3.8-dev libgmp3-dev
 ---> Running in 0b141af248f9
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Package libgmp3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libgmp-dev
E: Unable to locate package libglpk-dev
E: Unable to locate package python3.8-dev
E: Couldn't find any package by glob 'python3.8-dev'
E: Package 'libgmp3-dev' has no installation candidate
The command '/bin/sh -c apt install libglpk-dev python3.8-dev libgmp3-dev' returned a non-zero code: 100
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痕至 2025-02-01 12:42:24

致命错误:glpk.h:没有这样的文件或目录

您缺少GLPK的标头文件。为了确保这有用,请安装库:

RUN apt update && apt install -y libglpk-dev

fatal error: glpk.h: No such file or directory

You are missing the header file(s) for glpk. To make sure this is available, install the library:

RUN apt update && apt install -y libglpk-dev
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文