【问题标题】:Cant Install Tensorflow 2.2.0rc0 in Ubuntu with Github Actions inside setup.py无法使用 setup.py 中的 Github Actions 在 Ubuntu 中安装 Tensorflow 2.2.0rc0
【发布时间】:2020-06-28 23:15:43
【问题描述】:

当我尝试从 setup.py 安装 tensorflow>=2.2.0rc0 从 Github 操作工作流运行 python setup.py install 时,输出会发送给我:

Searching for tensorflow>=2.2.0rc0
Reading https://pypi.org/simple/tensorflow/
No local packages or working download links found for tensorflow>=2.2.0rc0
error: Could not find suitable distribution for Requirement.parse('tensorflow>=2.2.0rc0')
##[error]Process completed with exit code 1.

这是我的 Github Action 工作流程:

name: Test Deblurrer

on: 
  push:
    branches:
    - master
    - development 
  pull_request:
    branches:
    - master
    - development

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.7]

    steps:
    - uses: actions/checkout@v1
    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        sudo apt-get install libpq-dev python-dev
        python -m pip install --upgrade pip
        python setup.py install
        pip install pytest

    - name: Test with pytest
      run: |
        PYTHONPATH=${PYTHONPATH}:/home/runner/work/deep-deblurring/deep-deblurring/backend:$(pwd)
        pytest

接下来是我的 setup.py:

#!/usr/bin/python
# coding=utf-8

"""Setup and install the package and all the dependencies."""

from setuptools import setup, find_packages

with open('requirements.txt') as pro:
    INSTALL_REQUIRES = pro.read().split('\n')

setup(
    author='Whitman Bohorquez, Mo Rebaie',
    author_email='whitman-2@hotmail.com',
    name='deblurrer',
    license='MIT',
    description='Image Deblurring using Deep Learning Architecture',
    version='1.0.0',
    url='',
    packages=find_packages(),
    include_package_data=True,
    python_requires='>=3.6',
    install_requires=INSTALL_REQUIRES,
    classifiers=[
        'Development Status :: Alpha',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.6',
        'Intended Audience :: Developers',
    ],
)

最后,我的 requirements.txt:

grpcio == 1.27.2
kaggle
numpy
tensorflow >= 2.2.0rc0
pandas

我不明白为什么在 Github Actions 上会发生这种情况,但是在 Windows 10 上本地安装时,它可以按预期工作。

提前致谢!

PD:当我直接在 Github Action Workflow 上执行 pip install tensorflow==2.2.0rc0 而不是在 python setup.py install 内部时,它也可以工作。所以这不适用于setup.py,仅适用于 Ubuntu

【问题讨论】:

  • 不应该install_requireslist 吗?在你的情况下,它只是一个str。你可以使用这个:["".join(requirement.split()) for requirement in pro.read().split("\n")] 来正确分割它而不是pro.read()。其次,您不需要extras_require,它与INSTALL_REQUIRES 完全相同,也不是listmap,如果您正在测试某些东西,您应该使用toxpytest 或a-喜欢。最后,你的pwd 在这里可能是错误的,如果你想在阅读时与setup.py 在同一个地方,这会派上用场:HERE = pathlib.Path(__file__).resolve().parent
  • 感谢您指出,我会修复并回来!
  • python setup.py install 在后台使用setuptools。你使用什么setuptools 版本?你可以用例如检查。 python3 -c "import setuptools; print(setuptools.__version__)"。看起来您的目标机器上的 setuptools 相当旧,并且不支持 manylinux_2010 标记。检查通过python3 -c "from setuptools import pep425tags; print(pep425tags.get_supported()[0])" - 打印什么,manylinux1_x86_64
  • Hello @hoeflingHola 它在执行小脚本时会打印一个空行
  • @ElPapi42 你说你在 Linux 上有一个错误,但在 Windows 上执行命令。您应该将这两个命令添加到 Github Actions yaml 配置并触发管道以查看目标系统上的输出。

标签: python tensorflow pip github-actions


【解决方案1】:

问题在于过时的 setuptools 版本。从 2.0 开始,tensorflow 在 Linux 上只发布带有manylinux2010 标签的轮子。 setuptools 增加了对manylinux2010 in 42.0.0 的支持,所以升级setuptools 将解决这个问题:

$ pip install setuptools>=42.0.0

【讨论】:

  • 加起来,实际上 Github Actions Containers 附带 setuptools==41.2.0,这肯定会在未来改变
猜你喜欢
  • 1970-01-01
  • 2021-09-16
  • 1970-01-01
  • 2021-05-28
  • 1970-01-01
  • 2022-10-17
  • 2021-08-24
  • 1970-01-01
  • 2022-08-16
相关资源
最近更新 更多