Home > Enterprise >  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

Time:05-02

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

CodePudding user response:

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
  • Related