# Install dependencies on EC2Cluster

**URL:** https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579
**Category:** Distributed
**Created:** [October 17, 2024, 2:46pm UTC](https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579 "2024-10-17T14:46:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Sacha\_Van\_Weeren](https://yyz1.discourse-cdn.com/flex035/user_avatar/dask.discourse.group/sacha_van_weeren/32/1812_2.png) [@Sacha\_Van\_Weeren](https://dask.discourse.group/u/Sacha_Van_Weeren)
#### Post date: [October 17, 2024, 2:46pm UTC](https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579/1 "2024-10-17T14:46:14Z")

</div>

When start an EC2Cluster with

```auto
cluster = EC2Cluster(region="us-east-1",
                     # the Name is the IAM role name
                     iam_instance_profile=
                         {'Name': 'dask-cluster-ec2-role'},
                     n_workers=4, 
                     worker_instance_type='t2.medium', 
                     scheduler_instance_type='t2.micro',              
                     security=False)

```

and later try to create a dask dataframe from s3 I get an error message when I run a compute() method. Saying that s3fs is not installed. Is there a way to install this via an argument to EC2Cluster? If not what are alternatives?

---

<div class="post-metadata">

### Author: ![guillaumeeb](https://yyz1.discourse-cdn.com/flex035/user_avatar/dask.discourse.group/guillaumeeb/32/1613_2.png) [@guillaumeeb](https://dask.discourse.group/u/guillaumeeb)
#### Post date: [October 18, 2024, 4:45pm UTC](https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579/2 "2024-10-18T16:45:59Z")

</div>

Hi @Sacha_Van_Weeren, welcome to Dask Discourse forum,

I think the easiest solution would be to give some environement variable to the docker images, typically adding a kwarg:

```auto
cluster = EC2Cluster(region="us-east-1",
                     # the Name is the IAM role name
                     iam_instance_profile=
                         {'Name': 'dask-cluster-ec2-role'},
                     n_workers=4, 
                     worker_instance_type='t2.medium', 
                     scheduler_instance_type='t2.micro',              
                     security=False,
                     env_vars={'EXTRA_CONDA_PACKAGES': 's3fs'})

```

---

<div class="post-metadata">

### Author: ![Sacha\_Van\_Weeren](https://yyz1.discourse-cdn.com/flex035/user_avatar/dask.discourse.group/sacha_van_weeren/32/1812_2.png) [@Sacha\_Van\_Weeren](https://dask.discourse.group/u/Sacha_Van_Weeren)
#### Post date: [October 19, 2024, 3:43pm UTC](https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579/3 "2024-10-19T15:43:22Z")

</div>

Thanks a lot for your response. However when I run the above command. The cluster creations seems to hang. I tried it 2 times with the env-vars and 1 without. Without it continues with it, it gets stuck

---

<div class="post-metadata">

### Author: ![guillaumeeb](https://yyz1.discourse-cdn.com/flex035/user_avatar/dask.discourse.group/guillaumeeb/32/1613_2.png) [@guillaumeeb](https://dask.discourse.group/u/guillaumeeb)
#### Post date: [October 24, 2024, 11:45am UTC](https://dask.discourse.group/t/install-dependencies-on-ec2cluster/3579/4 "2024-10-24T11:45:48Z")

</div>

Maybe I didn’t give the correct syntax. Do you have some output logs of the containers start?

Another method a bit more complex would be to build you own docker image based on the Dask one with added dependencies. Ot you could use existing ones like the [Pangeo docker images](https://github.com/pangeo-data/pangeo-docker-images).

cc @jacobtomlinson
