Gitlab CI error : Could not build wheels for glpk which use PEP 517 and cannot be installed directly

Gitlab CI error : Could not build wheels for glpk which use PEP 517 and cannot be installed directly

我已经在我的 windows 机器上本地安装 glpk 并且 运行s。但是,作为 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 运行,我只是在我的 requirements.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:当我尝试提供的解决方案时 here 我收到以下错误:

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

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

您缺少 glpk 的头文件。为确保它可用,请安装库:

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