# Problems with generating metrics

**URL:** <https://discuss.dvc.org/t/problems-with-generating-metrics/1289>\
**Category:** Questions\
**Created:** [August 8, 2022, 5:59pm UTC](https://discuss.dvc.org/t/problems-with-generating-metrics/1289 "2022-08-08T17:59:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nenkoff](https://avatars.discourse-cdn.com/v4/letter/n/a6a055/32.png) [@Nenkoff](https://discuss.dvc.org/u/Nenkoff)\
**Post date:** [August 8, 2022, 5:59pm UTC](https://discuss.dvc.org/t/problems-with-generating-metrics/1289/1 "2022-08-08T17:59:43Z")

</div>

I have been trying to create a simple ML pipeline. On the evaluate stage I am creating the evaluation.json file that I state in the dvc.yaml → metrics: evaluation.json. However, when running dvc metrics show the terminal doesn’t output anything. Instead running dvc metrics show --json, yields an empty json. And whe running dvc metrics show -a -v, I get this:  
2022-08-08 20:50:23,307 DEBUG: Analytics is enabled.  
2022-08-08 20:50:23,344 DEBUG: Trying to spawn ‘[‘daemon’, ‘-q’, ‘analytics’, ‘/tmp/tmp6wqqs37o’]’  
2022-08-08 20:50:23,346 DEBUG: Spawned ‘[‘daemon’, ‘-q’, ‘analytics’, ‘/tmp/tmp6wqqs37o’]’

---

<div class="post-metadata">

**Author:** ![Paffciu](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@Paffciu](https://discuss.dvc.org/u/Paffciu)\
**Post date:** [August 9, 2022, 10:27am UTC](https://discuss.dvc.org/t/problems-with-generating-metrics/1289/2 "2022-08-09T10:27:54Z")

</div>

Hi! Do you, by any chance call `metrics` from non-root dir?  
We seem to have a problem with subdirs:

> <https://github.com/iterative/dvc/issues/8020>
>
> \# Bug Report
> 
> \<!--
> \## Issue name
> 
> Issue names must follow the pattern \`comm…and: description\` where the command is the dvc command that you are trying to run. The description should describe the consequence of the bug. 
> 
> Example: \`repro: doesn't detect input changes\`
> \--\>
> dvc metrics show doesn't output anything when called from a subdirectory of the repository.
> \## Description
> When the pipeline described in \`dvc.yaml\` is stored in a subdirectory e.g. \`pipeline\` of the repository and it contains a stage that produces a metric file e.g. \`metric.json\` within this same directory, running \`dvc metrics show\` within this directory doesn't ouptut anything. When calling \`dvc metrics show metric.json\`, the displayed path for the metric is not correct. Calling \`dvc metric show\` from the root of the repository seems to be ok. The issue was already looked at by @pared who provided the simplified script to reproduce the behavior.
> \<!--
> A clear and concise description of what the bug is.
> \--\>
> 
> \### Reproduce
> 
> \<!--
> Step list of how to reproduce the bug
> \--\>
> 
> \<!--
> Example:
> 
> 1. dvc init
> 2. Copy dataset.zip to the directory
> 3. dvc add dataset.zip
> 4. dvc run -d dataset.zip -o model ./train.sh
> 5. modify dataset.zip
> 6. dvc repro
> \--\>
> Run the following script:
> \`\`\`
> \#!/bin/bash
> 
> set -exu
> 
> wsp=test\_wspace
> rep=test\_repo
> 
> rm -rf $wsp && mkdir $wsp && pushd $wsp
> main=$(pwd)
> 
> mkdir $rep && pushd $rep
> 
> git init
> dvc init
> 
> echo '{"metric\_val": 1}' \> data.json
> dvc add data.json
> 
> mkdir pipeline
> pushd pipeline
> 
> dvc run -d ../data.json -m metric.json -n train cp ../data.json metric.json
> 
> git add -A
> git commit -am "initial"
> 
> echo "dvc metrics show in repo subdirectory"
> dvc metrics show -v
> 
> echo "dvc metrics show metric.json"
> dvc metrics show -v metric.json
> 
> popd
> echo "dvc metrics show in repo root"
> dvc metrics show -v
> \`\`\`
> \### Expected
> 
> \<!--
> A clear and concise description of what you expect to happen.
> \--\>
> The first call to \`dvc metrics show\` (in the \`pipeline\` subdirectory) doesn't output anything.
> The call to to \`dvc metrics show metric.json\` (in the \`pipeline\` subdirectory) outputs:
> \`\`\`console
> Path metric\_val
> ../metric.json 1
> \`\`\`
> The second call to \`dvc metrics show\` (in the repo root) outputs:
> \`\`\`console
> Path metric\_val
> pipeline/metric.json 1
> \`\`\`
> which is ok.
> '-v' option only adds lines of the following form:
> \`\`\`console
> 2022-07-15 14:16:08,463 DEBUG: Analytics is enabled.
> 2022-07-15 14:16:08,464 DEBUG: Trying to spawn '\['daemon', '-q', 'analytics', '/tmp/tmpiwodbd2a'\]'
> 2022-07-15 14:16:08,465 DEBUG: Spawned '\['daemon', '-q', 'analytics', '/tmp/tmpiwodbd2a'\]'
> \`\`\`
> \### Environment information
> 
> \<!--
> This is required to ensure that we can reproduce the bug.
> \--\>
> dvc was installed from repository on an Ubuntu 20.04 (WSL). I also have the same behavior on dvc installed with pip, within a conda environment on Ubuntu 20.04.
> \*\*Output of \`dvc doctor\`:\*\*
> 
> \`\`\`console
> $ dvc doctor
> \`\`\`
> \`\`\`console
> DVC version: 2.11.0 (deb)
> \---------------------------------
> Platform: Python 3.8.3 on Linux-5.10.102.1-microsoft-standard-WSL2-x86\_64-with-glibc2.14
> Supports:
> azure (adlfs = 2022.4.0, knack = 0.9.0, azure-identity = 1.10.0),
> gdrive (pydrive2 = 1.10.1),
> gs (gcsfs = 2022.5.0),
> hdfs (fsspec = 2022.5.0, pyarrow = 8.0.0),
> webhdfs (fsspec = 2022.5.0),
> http (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
> https (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
> s3 (s3fs = 2022.5.0, boto3 = 1.21.21),
> ssh (sshfs = 2022.6.0),
> oss (ossfs = 2021.8.0),
> webdav (webdav4 = 0.9.7),
> webdavs (webdav4 = 0.9.7)
> \`\`\`
> \*\*Additional Information (if any):\*\*
> 
> \<!--
> Please check https://github.com/iterative/dvc/wiki/Debugging-DVC on ways to gather more information regarding the issue.
> 
> If applicable, please also provide a \`--verbose\` output of the command, eg: \`dvc add --verbose\`.
> If the issue is regarding the performance, please attach the profiling information and the benchmark comparisons.
> \--\>
