Reputation: 37
I am currently trying to upload a flask-application as gitlab page using frozen-flask. However, the pipeline fails when trying to set up everything on the server. My .gitlab-ci.yml file looks like this:
image: python:3.9.5
pages:
before_script:
- apt update && apt install -y libgdal-dev
script:
- pip install --upgrade pip
- pip install --no-cache-dir -r requirements.txt
- FLASK_APP=app.py flask freeze
artifacts:
paths:
- public
only:
- master
And the requirements.txt file looks like this:
affine==2.3.0
beautifulsoup4==4.10.0
dask==2021.6.2
demessaging==0.1.3
Flask==1.1.2
Frozen_Flask==0.18
future==0.18.2
GDAL==3.3.0
geopandas==0.9.0
ipython==7.30.1
matplotlib==3.4.2
mlrose==1.3.0
networkx==2.3
numpy==1.21.0
osgeo==0.0.1
osr==0.0.1
pandas==1.2.5
Pillow==8.4.0
plotly==4.14.3
psyplot==1.3.1
pyhdf==0.10.3
pyproj==3.1.0
pysftp==0.2.9
python_dateutil==2.8.2
pytz==2021.1
rasterio==1.2.6
requests==2.25.1
rioxarray==0.6.1
salem==0.3.4
scikit_image==0.18.1
scikit_learn==1.0.1
scipy==1.7.0
Shapely==1.7.1
six==1.16.0
wradlib==1.2.1
xarray==0.18.2
The error in the failed pipeline refers to some issue with setting up the GDAL package. So, the script is running until the point where it has to set up all the packages in the environment, where it stops at the package GDAL. However, this error is very hard to figure out since it is very cryptic. I have not found a workaround yet and since I am relying on the GDAL package in the application I hope you can help me. Thanks in advance! The end of the error looks like this (the whole error message is huge and does not help here I think):
from extensions/gdal_array_wrap.cpp:174:
/usr/local/include/python3.9/ceval.h:130:37: note: declared here
Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
^~~~~~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wqrt2f9g/gdal_224acb310d654aeb97d659380ad0b7f2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wqrt2f9g/gdal_224acb310d654aeb97d659380ad0b7f2/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-cgdjkbmo/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/GDAL Check the logs for full command output.
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1
Upvotes: 1
Views: 170
Reputation: 41119
You need to install gcc to have the build tools needed. You can get this through apt
by installing gcc
or install the build-essential
meta-package which will include gcc and other common build requirements.
image: python:3.9-slim
pages:
before_script:
- apt update && apt install -y build-essential libgdal-dev
Upvotes: 1