【问题标题】:Gitlab-CI.yml, requirements.txt and TensorflowGitlab-CI.yml、requirements.txt 和 Tensorflow
【发布时间】:2019-12-18 21:36:49
【问题描述】:

我需要将 Tensorflow 添加到我的 requirements.txt 中。首先,我添加了没有特定版本的“tensorflow”,但在 Gitlab-CI linters 中给了我需要添加特定版本的信息,所以我添加了它,它看起来像“tensorflow == 2.0.0-rc0”,但在 Gitlab -CI 我明白了:

ERROR: Could not find a version that satisfies the requirement tensorflow==2.0.0-rc0 (from -r requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for tensorflow==2.0.0-rc0 (from -r requirements.txt (line 2))

CI 返回:

$ python --version
Python 3.8.0
$ pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (19.3.1)
$ pip install --upgrade setuptools
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/54/28/c45d8b54c1339f9644b87663945e54a8503cfef59cf0f65b3ff5dd17cf64/setuptools-42.0.2-py2.py3-none-any.whl (583kB)
Installing collected packages: setuptools
  Found existing installation: setuptools 41.6.0
    Uninstalling setuptools-41.6.0:
      Successfully uninstalled setuptools-41.6.0
Successfully installed setuptools-42.0.2
$ pip install -r requirements.txt
Collecting numpy==1.16.4
  Downloading https://files.pythonhosted.org/packages/d3/4b/f9f4b96c0b1ba43d28a5bdc4b64f0b9d3fbcf31313a51bc766942866a7c7/numpy-1.16.4.zip (5.1MB)
ERROR: Could not find a version that satisfies the requirement tensorflow==2.0.0-rc0 (from -r requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for tensorflow==2.0.0-rc0 (from -r requirements.txt (line 2))

和我的 .gitlab-ci.yml 的一部分:

image: "python:3.8"

before_script:
 - python --version
 - pip install --upgrade pip
 - pip install --upgrade setuptools
 - pip install -r requirements.txt

【问题讨论】:

  • 您使用的是哪个python 图像?
  • 我使用 Python 3.8.0
  • 尝试运行pip install --upgrade pip && pip install --upgrade setuptools && pip install --upgrade tensorflow==2.0.0-rc0
  • 那行不通。我在 before_script: 中向 CI 添加了安装 pip 和设置工具:并且我在 requirements.txt 中有 numpy==1.16.4 和 tensorflow==2.0.0-rc0。 Numpy 安装成功,但 tensorflow 没有。
  • 你可以运行python -c 'import struct;print( 8 * struct.calcsize("P"))'。它会检查你的python是32位还是64位

标签: tensorflow gitlab gitlab-ci requirements.txt


【解决方案1】:

从 Python 3.8 更改图像为 Python 3.7 为我工作。所以问题出在最新的 Python 3.8

【讨论】:

    猜你喜欢
    • 2019-03-14
    • 2020-02-14
    • 2021-05-06
    • 2019-02-08
    • 1970-01-01
    • 2021-03-21
    • 2022-01-08
    • 2018-03-10
    • 2019-08-28
    相关资源
    最近更新 更多