【发布时间】: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_requires是list吗?在你的情况下,它只是一个str。你可以使用这个:["".join(requirement.split()) for requirement in pro.read().split("\n")]来正确分割它而不是pro.read()。其次,您不需要extras_require,它与INSTALL_REQUIRES完全相同,也不是list或map,如果您正在测试某些东西,您应该使用tox、pytest或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