How to install 3rd party python packages on worker and head nodes?

I have a couple of 3rd party packages that my ray task depends on. I tried to install them on the worker and head nodes as follows in my cluster YML config:

cluster_name: snippets

provider:
  type: aws
  region: us-west-2

setup_commands:
  - pip install -U avilabs-snippets

However, this errors out because it does not install the ray package before it tries to run the ray executable. My question is what is a good way to install 3rd party python packages on ray cluster?

Hmm, I think you just need to do this:

cluster_name: snippets

provider:
  type: aws
  region: us-west-2

setup_commands:
  - pip install -U ray
  - pip install -U avilabs-snippets

Thanks! That works :slight_smile: