# Runtime\_env on driver node

**URL:** <https://discuss.ray.io/t/runtime-env-on-driver-node/8811>\
**Category:** Ray Core\
**Created:** [December 29, 2022, 6:36pm UTC](https://discuss.ray.io/t/runtime-env-on-driver-node/8811 "2022-12-29T18:36:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![valiantljk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/valiantljk/32/252_2.png) [@valiantljk](https://discuss.ray.io/u/valiantljk)\
**Post date:** [December 29, 2022, 6:36pm UTC](https://discuss.ray.io/t/runtime-env-on-driver-node/8811/1 "2022-12-29T18:36:05Z")

</div>

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

I used `runtime_env` to setup the dependencies on ray cluster, but it seems on driver side, I can’t import the installed modules. Is it expected that the new dependencies are only accessible in remote node?

My initial guess was that the dependency installation took a long time, therefore the driver side doesn’t have all the dependencies ready, and any remote task doesn’t run into issues because ray may have validation for each remote task’s runtime\_env.

In order to ensure all dependencies are ready, I launched a remote task with the runtime\_env, and wait for the task to finish before importing the module on driver side, however, the driver side still can’t import the module.

---

<div class="post-metadata">

**Author:** ![architkulkarni](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/architkulkarni/32/10_2.png) [@architkulkarni](https://discuss.ray.io/u/architkulkarni)\
**Post date:** [December 29, 2022, 6:57pm UTC](https://discuss.ray.io/t/runtime-env-on-driver-node/8811/2 "2022-12-29T18:57:05Z")

</div>

Yes, runtime environments only install the dependencies on the Ray cluster nodes, and the environment is only accessible by those actors and tasks.

By “driver side” do you mean a client machine that’s not part of the Ray cluster? If you want to run a driver script on the Ray cluster itself, you can try using the Ray Jobs API and specifying the runtime\_env using that API. [Ray Jobs Overview — Ray 2.2.0](https://docs.ray.io/en/latest/cluster/running-applications/job-submission/index.html) The driver script (`entrypoint`) will then run inside the specified runtime\_env.

---

<div class="post-metadata">

**Author:** ![valiantljk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/valiantljk/32/252_2.png) [@valiantljk](https://discuss.ray.io/u/valiantljk)\
**Post date:** [December 29, 2022, 7:07pm UTC](https://discuss.ray.io/t/runtime-env-on-driver-node/8811/3 "2022-12-29T19:07:11Z")

</div>

By `driver side`, I mean the head node, where I run the driver script and ray.init. Yes, it’s within the ray cluster. But looks like I can’t import modules on there.

---

<div class="post-metadata">

**Author:** ![architkulkarni](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/architkulkarni/32/10_2.png) [@architkulkarni](https://discuss.ray.io/u/architkulkarni)\
**Post date:** [December 29, 2022, 7:19pm UTC](https://discuss.ray.io/t/runtime-env-on-driver-node/8811/4 "2022-12-29T19:19:32Z")

</div>

Ah, the runtime env is only active for tasks and actors. It uses `virtualenv` and modifies `PYTHONPATH` for the worker processes; the environment isn’t installed “globally” on the node.

If you want to import things outside of tasks and actors, you can install the environment manually, or use the Ray Jobs API and specify the runtime\_env there.
