cml icon indicating copy to clipboard operation
cml copied to clipboard

cml: command not found

Open Vighnesh1234 opened this issue 2 years ago • 13 comments

I am a new user. When the ci cd pipeline runs it throws the error as cml:command not found.

Requirement already satisfied: six>=1.5 in /usr/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->-r requirements.txt (line 3)) (1.16.0)
$ python train.py
0.852
$ cat metrics.txt >> report.md
$ echo '![](./plot.png "Confusion Matrix")' >> report.md
$ cml comment create report.md
bash: cml: command not found
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1

my ci cd pipeline as follows


train-and-report:
  image: iterativeai/cml:0-dvc2-base1
  script:
    - pip install -r requirements.txt
    - python train.py # generate plot.png
    # Create CML report
    - cat metrics.txt >> report.md
    - echo '![](./plot.png "Confusion Matrix")' >> report.md
    - cml comment create report.md
  tags:
    - runner-tester
   

Vighnesh1234 avatar Jan 19 '23 17:01 Vighnesh1234

Hello, @Vighnesh1234! Where are you running that code? GitHub Actions, GitLab CI/CD or Bitbucket Pipelines?

0x2b3bfa0 avatar Jan 19 '23 17:01 0x2b3bfa0

Hello, @Vighnesh1234! Where are you running that code? GitHub Actions, GitLab CI/CD or Bitbucket Pipelines?

I am running on gitlab

Vighnesh1234 avatar Jan 19 '23 17:01 Vighnesh1234

The following works as expected on GitLab-hosted runners:

example:
  image: iterativeai/cml:0-dvc2-base1
  script:
    - cml comment create report.md

Maybe your runner-tester self-hosted runner has an outdated (and broken) container image in the cache or is using the shell executor for some reason?

0x2b3bfa0 avatar Jan 19 '23 17:01 0x2b3bfa0

I am learning.

I was initially using shell executor. (using my machine as runner host)

Now tried with docker executor ( provided default image as ruby:2.4), and it still throws the same error.

What would you recommend to use as executor?

I can see the following options :

docker, parallels, docker-ssh+machine, Kubernetes, docker+machine, instance, custom, docker-ssh, shell, ssh, Virtualbox.

Vighnesh1234 avatar Jan 19 '23 18:01 Vighnesh1234

Now tried with docker executor ( provided default image as ruby:2.4), and it still throws the same error.

You're almost there! Please try using both the docker executor in conjunction with image: iterativeai/cml:0-dvc2-base1

0x2b3bfa0 avatar Jan 19 '23 18:01 0x2b3bfa0

@0x2b3bfa0 - I appreciate the inputs

facing new errors

$ cml comment create report.md
{"level":"error","message":"token not found","stack":"Error: token not found\n    at new Gitlab (/usr/lib/node_modules/@dvcorg/cml/src/drivers/gitlab.js:21:23)\n    at CML.getDriver (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:158:35)\n    at CML.commentCreate (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:180:22)\n    at Object.exports.handler (/usr/lib/node_modules/@dvcorg/cml/bin/cml/comment/create.js:11:25)\n    at /usr/lib/node_modules/@dvcorg/cml/node_modules/yargs/build/index.cjs:1:8891\n    at /usr/lib/node_modules/@dvcorg/cml/node_modules/yargs/build/index.cjs:1:4949"}
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Vighnesh1234 avatar Jan 19 '23 19:01 Vighnesh1234

@Vighnesh1234, please try setting CML_TOKEN as shown in the documentation.[^1]

  1. Navigate to User SettingsAccess Tokens
    • In the "Name" field, type CML_TOKEN
    • Select api, read_repository and write_repository
    • Click "Create personal access token" and copy it
  2. In your GitLab project, navigate to SettingsCI/CDVariablesAdd Variable
    • In the "Key" field, type CML_TOKEN
    • In the "Value" field, paste your Personal Access Token
    • Select "Mask variable"
    • Deselect "Protect variable"
    • Click "Add variable" at the bottom of the dialog box

[^1]: In fact, the documentation says REPO_TOKEN but that information is outdated; please use CML_TOKEN instead.

0x2b3bfa0 avatar Jan 19 '23 22:01 0x2b3bfa0

Apologies for delay in replying.

I was able to add the CML token.

Facing the following error:

Skipping Git submodules setup
Executing "step_script" stage of the job script
01:50
Using docker image sha256:45e46bace2f30643aed40ec7ba01ea4c777840eff633b414dea82f1be9f074a4 for iterativeai/cml:0-dvc2-base1 with digest iterativeai/cml@sha256:ebbae7b681ba1b54496f2a08bd85c0a6d499e546f31ba7af307b4bf4904f5aa0 ...
$ pip3 install -r requirements.txt
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (45.2.0)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/scikit-learn/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/scikit-learn/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/scikit-learn/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/scikit-learn/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/scikit-learn/
ERROR: Could not find a version that satisfies the requirement scikit-learn (from versions: none)
ERROR: No matching distribution found for scikit-learn

Vighnesh1234 avatar Jan 25 '23 20:01 Vighnesh1234

Sounds like a PyPI issue; can you retry the workflow? 🤔

0x2b3bfa0 avatar Jan 26 '23 07:01 0x2b3bfa0

I tired adding - pip3 install --default-timeout=100 future , it still times out.

I tried so many times and ended with PyPI timeouts. :(

Vighnesh1234 avatar Jan 26 '23 14:01 Vighnesh1234

Hai @Vighnesh1234, have you managed to resolve this issue?

RaghavaAlajangi avatar Jun 12 '23 09:06 RaghavaAlajangi

I tired adding - pip3 install --default-timeout=100 future , it still times out.

I tried so many times and ended with PyPI timeouts. :(

It's still an issue. Were you able to solve it?

iddqd-dev avatar Feb 29 '24 11:02 iddqd-dev

Can you share the cml runner command you used? Are you targeting a custom subnet or VPC, have you made any changes to your default VPC?

dacbd avatar Feb 29 '24 17:02 dacbd