python - 无法使用 setup.py 中的 Github Actions 在 Ubuntu 中安装 Tensorflow 2.2.0rc0
问题描述
当我尝试从 Github Actions Workflow 运行安装tensorflow>=2.2.0rc0
时,输出setup.py
会发送给我: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:当我pip install tensorflow==2.2.0rc0
直接在 Github Action Workflow 上执行而不是在它内部python setup.py install
时,它也可以工作。所以这setup.py
不仅适用于 Ubuntu,而且仅适用于 Ubuntu
解决方案
问题在于setuptools
版本过时。从 2.0 开始,只在 Linux 上提供带有标签的tensorflow
轮子。在 42.0.0中添加了支持,因此升级将解决问题:manylinux2010
setuptools
manylinux2010
setuptools
$ pip install setuptools>=42.0.0
推荐阅读
- ios - Swift Popup 如何将值传递给 PopupViewController
- php - json 中出现意外的“s”时
- sockets - Nginx 和 Webpack-Dev-Server 出现错误“net::ERR_CERT_COMMON_NAME_INVALID”
- firebase - 如何从 itemBuilder 访问查询?
- spring-integration - 对 HttpOutboundGateway 进行轮询
- c++ - 多重声明与未定义
- javascript - 无法让预先编写的 Tizen 应用程序工作
- python - tree.put(key, value) 插入
- c# - 使用事件而不是抽象方法有什么好处?C#
- java - 将数组中的字符串与输入字符串进行比较?