[英]Configuring .gitlab-ci.yml file in Gitlab to test python Codes
[英]Gitlab Flask Page: Problems with installing python GDAL package for Frozen Flask Application with .gitlab-ci.yml file
我目前正在尝试使用冷冻瓶将烧瓶应用程序上传为 gitlab 页面。 但是,当尝试在服务器上设置所有内容时,管道会失败。 My.gitlab-ci.yml 文件如下所示:
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
requirements.txt 文件如下所示:
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
失败管道中的错误是指设置 GDAL package 的一些问题。 因此,脚本一直运行,直到它必须在环境中设置所有包,它在 package GDAL 处停止。 但是,这个错误很难弄清楚,因为它非常神秘。 我还没有找到解决方法,因为我在应用程序中依赖 GDAL package,我希望你能帮助我。 在此先感谢:错误的结尾看起来像这样(整个错误消息很大,我认为在这里没有帮助):
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
您需要安装 gcc 以获得所需的构建工具。 您可以通过安装apt
或安装包含 gcc 和其他常见构建要求的build-essential
元包来实现此gcc
。
image: python:3.9-slim
pages:
before_script:
- apt update && apt install -y build-essential libgdal-dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.