alibaba / alibaba/funcraft

fun build 在非 docker 模式下安装 python 依赖 pymssql 报错

Open
#812 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
931
Forks
128
PR merge metrics
No merged PRs in 30d

Description

requirements.txt
```
pymssql
```

```bash
$ fun build
using template: template.yml
start building function dependencies without docker

building fc-sqlserver/python
running task flow PipTaskFlow
running task: PipInstall
Collecting pymssql
Using cached https://files.pythonhosted.org/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ch/fr5drc4n2dxfsj4x925t41nh0000gn/T/pip-install-ewqpwar8/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/ch/fr5drc4n2dxfsj4x925t41nh0000gn/T/pip-install-ewqpwar8/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/ch/fr5drc4n2dxfsj4x925t41nh0000gn/T/pip-install-ewqpwar8/pymssql/pip-egg-info
cwd: /private/var/folders/ch/fr5drc4n2dxfsj4x925t41nh0000gn/T/pip-install-ewqpwar8/pymssql/
Complete output (7 lines):
/usr/local/lib/python3.7/site-packages/setuptools/dist.py:46: DistDeprecationWarning: Do not call this function
warnings.warn("Do not call this function", DistDeprecationWarning)
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/ch/fr5drc4n2dxfsj4x925t41nh0000gn/T/pip-install-ewqpwar8/pymssql/setup.py", line 88, in
from Cython.Distutils import build_ext as _build_ext
ModuleNotFoundError: No module named 'Cython'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
```

## workaround

通过 `-d` 选项开启 docker 构建

```bash
$ fun build -d python
using template: template.yml
start building functions using docker

building fc-sqlserver/python
skip pulling image aliyunfc/runtime-python3.6:build-1.9.4...

build function using image: aliyunfc/runtime-python3.6:build-1.9.4
running task flow PipTaskFlow
running task: PipInstall
running task: CopySource

Build Success

Built artifacts: .fun/build/artifacts
Built template: .fun/build/artifacts/template.yml

Tips for next step
======================
* Invoke Event Function: fun local invoke
* Invoke Http Function: fun local start
* Deploy Resources: fun deploy
```

## 期望

识别到 requirements.txt 里有 pymssql 自动开启 `-d` 模式。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `fun build` dependency-install path, particularly the `PipTaskFlow` and `PipInstall` steps shown in the report. Reproduce the failure with a `requirements.txt` containing `pymssql`, compare it with `fun build -d python`, and determine how dependency detection can select Docker automatically. Done means this dependency builds successfully without requiring users to add `-d`.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.