Running python3 and pip commands in Bamboo using Remote Agent

I have a remote agent dedicated to my Bamboo Build Plan. I want to run a python script, which requires pip installation of libraries before the script can execute. I’ve already added the pip and python executables into the remote agent’s capabilities, as such:

Broken Links:
  - checkout:
      force-clean-build: 'false'
      description: Checkout Default Repository
  - script:
      interpreter: BINSH_OR_CMDEXE
        - pip install BeautifulSoup4
        - pip install lxml
        - pip install requests
        - python3
    - Python38
    - pip

But, when I run the pipeline, I get the error that pip and python3 are not recognised commands. Please help

That is because your agent does not have a path to those directories. Also I think you would be better using 4 command tasks where each task has one line from the script. Because then it will be able to reference your capabilities. Also it should then automate the requirements based on the command you are running. Just remember to add everything after pip or python3 as arguments.

Provided the Java Bamboo Spec way of doing it below, hopefully you can translate it to yml.

new CommandTask()
   .description("Synchronize Jira Metrics")