# Will ray worker install python packages in the run time?

**URL:** https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721
**Category:** Ray Core
**Created:** [July 5, 2022, 10:06am UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721 "2022-07-05T10:06:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jie](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jie](https://discuss.ray.io/u/jie)
#### Post date: [July 5, 2022, 10:06am UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/1 "2022-07-05T10:06:42Z")

</div>

ray job submit --address=‘[http://address](http://address)’ --runtime-env-json=‘{“working\_dir”:“./” , “pip”:[“smmap”]}’ – python ./job.py

The ray worker does not have the package “smmap”. I have had used this instruction to submit a job to this ray worker, and after the submitting , I have got a error "No module named ‘smmap’ ". Does this mean ray worker will not install python packages in the run time?

If I want ray worker to install package in the run time, How can I solve it?

---

<div class="post-metadata">

### Author: ![Stephanie\_Wang](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/stephanie_wang/32/18_2.png) [@Stephanie\_Wang](https://discuss.ray.io/u/Stephanie_Wang)
#### Post date: [July 5, 2022, 5:55pm UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/2 "2022-07-05T17:55:19Z")

</div>

The python packages should get installed at run time, so it’s possible this is a bug or maybe a mistake in the API usage.

CC’ing @shrekris who can help you further.

---

<div class="post-metadata">

### Author: ![shrekris](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@shrekris](https://discuss.ray.io/u/shrekris)
#### Post date: [July 5, 2022, 11:21pm UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/3 "2022-07-05T23:21:27Z")

</div>

Yes, you should have access to the `smmap` module at runtime. Do you mind posting a reproduction script? What are the contents of `job.py`?

---

<div class="post-metadata">

### Author: ![jie](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jie](https://discuss.ray.io/u/jie)
#### Post date: [July 6, 2022, 12:45am UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/4 "2022-07-06T00:45:52Z")

</div>

Thanks!

**This is the codes included in the job.py .**

```auto
import ray
import requests
import smmap
import sys

ray.init()

@ray.remote
class Counter:
    def __init__ (self):
        self.counter = 0

    def inc(self):
        print("ok")

counter = Counter.remote()

for _ in range(5):
    ray.get(counter.inc.remote())

print(sys.version)

```

**I use this instruction to submit the job.**

```auto
ray job submit --address=‘http://192.168.0.166:8265’ --runtime-env-json=‘{“working_dir”:“./” , “pip”:[“smmap”]}’ -- /home/wanjia/conda/env1/bin/python ./job.py

```

I submit the job from my ray node to a remote ray node(192.198.0.166:8265). And this is the error message:

```auto
Job submission server address: http://192.168.0.166:8265
2022-07-06 14:55:02,101	INFO dashboard_sdk.py:272 -- Uploading package gcs://_ray_pkg_90994eb4a30dc674.zip.
2022-07-06 14:55:02,101	INFO packaging.py:479 -- Creating a file package for local directory './'.

-------------------------------------------------------
Job 'raysubmit_z9DDa2AMUUGxzb8Z' submitted successfully
-------------------------------------------------------

Next steps
  Query the logs of the job:
    ray job logs raysubmit_z9DDa2AMUUGxzb8Z
  Query the status of the job:
    ray job status raysubmit_z9DDa2AMUUGxzb8Z
  Request the job to be stopped:
    ray job stop raysubmit_z9DDa2AMUUGxzb8Z

Tailing logs until the job exits (disable with --no-wait):
Traceback (most recent call last):
  File "./job.py", line 3, in <module>
    import smmap
ModuleNotFoundError: No module named 'smmap'

---------------------------------------
Job 'raysubmit_z9DDa2AMUUGxzb8Z' failed
---------------------------------------

Status message: Job failed due to an application error, last available logs:
Traceback (most recent call last):
  File "./job.py", line 3, in <module>
    import smmap
ModuleNotFoundError: No module named 'smmap'

```

---

<div class="post-metadata">

### Author: ![shrekris](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@shrekris](https://discuss.ray.io/u/shrekris)
#### Post date: [July 6, 2022, 5:37pm UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/5 "2022-07-06T17:37:02Z")

</div>

Thanks for posting the repro! This does seem like a bug, since I believe `smmap` should be importable in this script. Do you mind filing an issue [here](https://github.com/ray-project/ray/issues/new?assignees=&labels=bug%2Ctriage&template=bug-report.yml&title=%5B%3CRay+component%3A+Core%7CRLlib%7Cetc...%3E%5D+), so we can track it?

---

<div class="post-metadata">

### Author: ![jie](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jie](https://discuss.ray.io/u/jie)
#### Post date: [July 7, 2022, 1:36am UTC](https://discuss.ray.io/t/will-ray-worker-install-python-packages-in-the-run-time/6721/6 "2022-07-07T01:36:45Z")

</div>

Thanks for you reply. Yes, I do think so too! We intend to do some test to **check whether ray worker will install python packages at runtime**.

For this intent, we not just tested the package “smmap” which is a small package and takes only a short time to download. Correspondingly, we also took packages like `numpy` and `torch` for testing, but we got the same message.

I have posted an [issue](https://github.com/ray-project/ray/issues/26342) to our ray project in github.
