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

**URL:** <https://discuss.ray.io/t/how-to-install-3rd-party-python-packages-on-worker-and-head-nodes/2506>\
**Category:** Ray Core\
**Created:** [June 13, 2021, 10:15pm UTC](https://discuss.ray.io/t/how-to-install-3rd-party-python-packages-on-worker-and-head-nodes/2506 "2021-06-13T22:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avilay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/avilay/32/1133_2.png) [@avilay](https://discuss.ray.io/u/avilay)\
**Post date:** [June 13, 2021, 10:15pm UTC](https://discuss.ray.io/t/how-to-install-3rd-party-python-packages-on-worker-and-head-nodes/2506/1 "2021-06-13T22:15:31Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [June 15, 2021, 5:15pm UTC](https://discuss.ray.io/t/how-to-install-3rd-party-python-packages-on-worker-and-head-nodes/2506/2 "2021-06-15T17:15:22Z")

</div>

Hmm, I think you just need to do this:

```auto
cluster_name: snippets

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

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

```

---

<div class="post-metadata">

**Author:** ![avilay](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/avilay/32/1133_2.png) [@avilay](https://discuss.ray.io/u/avilay)\
**Post date:** [June 26, 2021, 3:20am UTC](https://discuss.ray.io/t/how-to-install-3rd-party-python-packages-on-worker-and-head-nodes/2506/3 "2021-06-26T03:20:32Z")

</div>

Thanks! That works 🙂
