求助 | 有偿 Python 项目部署支持 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
abbyyhk
V2EX    外包

求助 | 有偿 Python 项目部署支持

  •  
  •   abbyyhk 242 天前 1717 次点击
    这是一个创建于 242 天前的主题,其中的信息可能已经有所发展或是发生改变。
    求助 | 有偿服务器部署支持

    我们正在部署一个 Python 网站,服务器环境 CentOS ,使用 Ansible + Poetry 进行自动化部署。目前卡在 Poetry 安装报错,尝试多种方法仍未解决。

    已有 GitHub 项目
    项目地址: https://github.com/techlib/celus
    Ansible-Playbook: https://github.com/techlib/celus/blob/master/docs/ansible/roles/celus/tasks/main.yaml
    Line 28-56
    阿里云服务器
    愿意支付报酬,感谢技术支持!

    问题详情:Poetry 安装后,运行 poetry install 报错,可能与 Poetry 版本兼容性相关。

    如果你有经验,或能提供解决方案,请联系!
    vx base64 cGFkemh1

    #Python #DevOps #Ansible #Poetry #服务器部署
    17 条回复    2025-03-17 11:41:52 +08:00
    crackidz
        1
    crackidz  
       242 天前
    有没有考虑过是 Python 版本问题...
    MoliOOO
        2
    MoliOOO  
       242 天前
    CentOS 版本、Python 版本?
    poetry install 报错信息?
    abbyyhk
        3
    abbyyhk  
    OP
       242 天前
    @crackidz python 版本是 3.6.8
    kylezb
        4
    kylezb  
       242 天前
    不是很懂,但是 34 行的 get-poetry.py 链接是 404 ,portry master 仓库里也没这个文件。
    xscanqianmeng666
        5
    xscanqianmeng666  
       242 天前
    为啥不用 docker
    abbyyhk
        6
    abbyyhk  
    OP
       242 天前
    @rooftop64 Ansible playbook:
    - name: check that poetry command exists
    stat: path=/root/.poetry/bin/poetry
    register: _poetry_executable

    - name: download the poetry installer
    get_url:
    url: https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
    dest: /tmp/get-poetry.y
    when: _poetry_executable.stat.exists == false

    - name: run the poetry installer
    command: /usr/bin/python3 /tmp/get-poetry.py -y
    when: _poetry_executable.stat.exists == false

    - name: install specific poetry version
    command: /root/.poetry/bin/poetry self update 1.1.8
    environment:
    VIRTUAL_ENV: /opt/virtualenvs/{{ project_name }}
    tags:
    - git_update

    - name: install project python dependencies using poetry
    environment:
    VIRTUAL_ENV: /opt/virtualenvs/{{ project_name }}
    command: /root/.poetry/bin/poetry install
    args:
    chdir: /opt/{{ project_name }}
    tags:
    - git_update

    Error msg:
    TASK [celus : install project python dependencies using poetry] *******************************************************************************************************
    fatal: [47.243.249.94]: FAILED! => {
    "changed": true,
    "cmd": ["/root/.poetry/bin/poetry", "install"],
    "delta": "0:00:00.770595",
    "end": "2025-03-13 09:09:32.128918",
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2025-03-13 09:09:31.358323",
    "stderr": "
    RuntimeError

    The Poetry configuration is invalid:
    - Additional properties are not allowed ('package-mode' was unexpected)

    at ~/.poetry/venv/lib64/python3.6/site-packages/poetry/core/factory.py:45 in create_poetry
    41│ message = \"\"
    42│ for error in check_result[\"errors\"]:
    43│ message += \" - {}\\n\".format(error)
    44│
    → 45│ raise RuntimeError(\"The Poetry configuration is invalid:\\n\" + message)
    46│
    47│ # Load package
    48│ name = local_config[\"name\"]
    49│ version = local_config[\"version\"]
    ",
    "stderr_lines": [
    "",
    " RuntimeError",
    "",
    " The Poetry configuration is invalid:",
    " - Additional properties are not allowed ('package-mode' was unexpected)",
    " ",
    "",
    " at ~/.poetry/venv/lib64/python3.6/site-packages/poetry/core/factory.py:45 in create_poetry",
    " 41│ message = \"\"",
    " 42│ for error in check_result[\"errors\"]:",
    " 43│ message += \" - {}\\n\".format(error)",
    " 44│ ",
    " → 45│ raise RuntimeError(\"The Poetry configuration is invalid:\\n\" + message)",
    " 46│ ",
    " 47│ # Load package",
    " 48│ name = local_config[\"name\"]",
    " 49│ version = local_config[\"version\"]"
    ],
    "stdout": "",
    "stdout_lines": []
    }

    Poetry pyproject.toml
    https://github.com/techlib/celus/blob/master/pyproject.toml
    vicalloy
        7
    vicalloy  
       242 天前
    celus 这个项目要求的 python 版本是 3.8 ,你的 python 版本太老了。
    abbyyhk
        8
    abbyyhk  
    OP
       242 天前
    @kylezb 对,旧 Poetry 仓库失效了,这个地方需要改,但我不知道怎么改成新版的安装方式
    旧仓库: https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
    新:curl -sSL https://install.python-poetry.org | python3 -

    ref: https://python-poetry.org/docs/#installing-with-the-official-installer
    abbyyhk
        9
    abbyyhk  
    OP
       242 天前
    @rooftop64
    CentOS Alibaba Cloud Linux 3.2104 LTS 64 位
    Python 3.6.8
    MoliOOO
        11
    MoliOOO  
       242 天前
    安装的 poetry 版本多少?
    celus 版本没要求的话,可以用 https://github.com/techlib/celus/archive/refs/tags/v1.0.39.tar.gz 试下
    tomczhen
        12
    tomczhen  
       242 天前
    poetry1.x 版本应该是兼容的,可以试试装 1.8.5 这个版本试试。Python 版本没匹配上,可以试试下载 Python standalone 里面的静态编译包作为解释器省的再弄编译安装。
    abbyyhk
        13
    abbyyhk  
    OP
       242 天前
    @rooftop64 感谢大佬,我试下!
    robinlovemaggie
        14
    robinlovemaggie  
       242 天前
    @abbyyhk poetry 安装脚本过期了,换成这个:
    https://install.python-poetry.org/
    enrolls
        15
    enrolls  
       242 天前
    为什么用 Poetry 做环境管理呢?你要做环境管理,环境隔离,有很多替代方案,而不应该卡在“Poetry 安装报错”上。哪怕原生的 venv 都有方案,我自己在用,还没放工具出来。
    Martin123123
        16
    Martin123123  
       242 天前
    绿泡泡已联系
    defunct9
        17
    defunct9  
       238 天前
    已解决。问题是很荒谬的。用 poetry 是根本不行的。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     991 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 37ms UTC 19:20 PVG 03:20 LAX 11:20 JFK 14:20
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86