title: Azure Self hosted agent to run pytest
body: <p>I have installed a self-hosted agent on my local VM, it's connected to azure no issues there.
  I have a python code on azure DevOps
  I have installed all the requirements.txt requirements manually into the cmd line of the local VM so that self-hosted agent installed on it doesn't have to install them ( to minimize the build &amp; deployment time)</p>
  <p>But when I have below code in the YAML file to run pytest cases pipeline is failing because of below error</p>
  <p><strong>This is my Yaml file</strong></p>
  <pre class="lang-yaml prettyprint-override"><code>    trigger:
          - master
          variables:
            python.version : 3.8.6
  
          stages:
          - stage: Build
            jobs: 
            - job: Build
              pool:
                name: 'MaitQA'
              #pool:
              #  vmImage: 'windows-latest'   # windows-latest Or windows-2019 ; vs2017-win2016 # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&amp;tabs=yaml#software # vs2017-win2016
  
              steps:
                - task: UsePythonVersion@0
                  inputs:
                    versionSpec: '$(python.version)'
                  displayName: 'Use Python $(python.version)'
                  
  
          - script: 'pip install pytest pytest-azurepipelines ; pytest unit_test/'
                  
  </code></pre>
  <blockquote>
  <p><em>This is The error
  --------------- Starting: Use Python 3.8.6
  ------------------------------ Task         : Use Python version Description  : Use the specified version of Python from the tool cache, optionally adding it to the PATH Version      : 0.151.4 Author  : Microsoft Corporation Help         : <a href="https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/use-python-version" rel="nofollow noreferrer">https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/use-python-version</a>
  ------------------------------------------- [error]Version spec 3.8.6 for architecture x64 did not match any version in Agent.ToolsDirectory. Versions in C:\CodeVersions_tool:
  If this is a Microsoft-hosted agent, check that this image supports side-by-side versions of Python at <a href="https://aka.ms/hosted-agent-software" rel="nofollow noreferrer">https://aka.ms/hosted-agent-software</a>. If this is a self-hosted agent, see how to configure side-by-side Python versions at <a href="https://go.microsoft.com/fwlink/?linkid=871498" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=871498</a>. Finishing: Use Python
  3.8.6
  ---------------</em></p>
  </blockquote>