没有这样的文件或目录:’requirements.txt’

huangapple go评论65阅读模式
英文:

No such file or directory: 'requirements.txt'

问题

以下是要翻译的内容:
在GitHub Actions中遇到以下错误:

默认用户安装,因为无法写入常规site-packages
错误:无法打开requirements文件:[Errno 2]没有这样的文件或目录:“requirements.txt”
错误:进程以退出码1完成

ci.yaml

名称:GitHub Actions演示

上:[推送]

工作:
  我的第一个工作:
    运行在:ubuntu-latest
    步骤:
      - 使用:actions/checkout@v3
      - 名称:你好
        运行:|
          回声 “测试”
      - 名称:运行python脚本
        运行:|
          python pip install -r requirements.txt
          python ci.py

将第一行运行代码更改为 python -m pip install -r requirements.txt 并获得相同错误。也尝试过 pip install -r requirements.txt 但失败。

ci.py

导入wandb


打印(f'The version of wandb is: {wandb.__version__}')
英文:

Following a tutorial to practice using GitHub actions but I am getting an error despite seemingly having what the instructor has. Will simply echo "test", install wandb, and print the wandb version.

Getting the following error in GitHub actions:

Run pip install -r requirements.txt
  pip install -r requirements.txt
  python ci.py
  shell: /usr/bin/bash -e {0}
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
Error: Process completed with exit code 1.

All the files are in the repository and in the same gregorywmorris/w-b-cicd/.github/workflows/ folder. What does this error mean?

ci.yaml

name: GitHub Actions Demo

on: [push]

jobs:
  my-first-job:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: hello
        run: |
          echo "Test"
      - name: run python script
        run: |
          python pip install -r requirements.txt
          python ci.py

Changed the first run line to python -m pip install -r requirements.txt and got the same error. Also failed with pip install -r requirements.txt.

ci.py

import wandb


print(f'The version of wandb is: {wandb.__version__}')

requirements.txt

wandb

答案1

得分: 0

已由 @hakre 在评论中回答。需要在最后的运行命令中将.github/workflows/添加到要求和ci.py的要求中。

已更正:

run: |
    python -m pip install -r .github/workflows/requirements.txt
    python .github/workflows/ci.py    

我是按照Weights and Bias的教程操作的,以便其他可能遇到此问题的人可以跟随教程。如果您将要求和ci.py文件放在主目录中,那么就不必指定位置。

英文:

Answered by @hakre in the comments. Need to add .github/workflows/ to both the requirements and ci.py in the last run command.

Corrected:

run: |
    python -m pip install -r .github/workflows/requirements.txt
    python .github/workflows/ci.py

Was following the tutorial by Weights and Bias for others that may come across this issue while following the tutorial. If you place the requirements and ci.py file in the main directory, then you don't have to specify the location.

huangapple
  • 本文由 发表于 2023年5月7日 06:11:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76191386.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定