Is jq installed and available on PATH?
Asked Answered
A

2

8

I am trying to read a yaml file in gitlab CI. I installed jq==1.0.2 and yq==2.10.1 using pip in my CI job and I use python:3.7 image. When I tried to read the yaml file, it has the error

yq: Error starting jq: FileNotFoundError: [Errno 2] No such file or directory: 'jq': 'jq'. Is jq installed and available on PATH?

My yaml file is not call jq and I do have this yaml file in my commit. I am able to do which yq, when I do which jq, the CI job failed. Anyone has any idea?

Anandrous answered 5/8, 2020 at 13:28 Comment(0)
D
9

Your jq installation is not quite correct. Your version information jq==1.0.2 indicates that you have installed the python package jq - https://pypi.org/project/jq/ which is not the same as the executable binary jq that gets installed. You need the executable to be installed, before invoking the yq tool.

Since yq looks in PATH for availability of the jq binary, but doesn't find it, you get the runtime error indicating the absence. The fix will be setup your CI to download the jq binary from one of the steps mentioned in https://stedolan.github.io/jq/download/

Dees answered 5/8, 2020 at 13:38 Comment(0)
B
3

Run sudo apt-get install jq not pip3 install jq.

Brevier answered 8/11, 2021 at 17:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.