# (raylet) ModuleNotFoundError: No module named 'ray' with installed ray

**URL:** <https://discuss.ray.io/t/raylet-modulenotfounderror-no-module-named-ray-with-installed-ray/12625>\
**Category:** Debugging and performance tuning\
**Created:** [October 27, 2023, 5:19pm UTC](https://discuss.ray.io/t/raylet-modulenotfounderror-no-module-named-ray-with-installed-ray/12625 "2023-10-27T17:19:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chvbs2000](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chvbs2000](https://discuss.ray.io/u/chvbs2000)\
**Post date:** [October 27, 2023, 5:19pm UTC](https://discuss.ray.io/t/raylet-modulenotfounderror-no-module-named-ray-with-installed-ray/12625/1 "2023-10-27T17:19:28Z")

</div>

HI,

I am using Python==3.10, ray==2.6.1. I am confused why I keep getting this error when I have ray installed:

```auto
(raylet) File "/home/anaconda3/envs/myvirenv_py310/lib/python3.10/site-packages/ray/_private/workers/default_worker.py", line 7, in <module>
(raylet) import ray
(raylet) ModuleNotFoundError: No module named 'ray'

```

But there was no such error when I open a python env and import it:

```auto
(myvirenv_py310) [ubuntu@myserveraddress00]$ python
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ray
>>>

```

What I did for trouble shoot:

- I created a virtual environment with conda python3.10 and installed ray==2.6.1 in the virtual environment using pip install ray==2.6.1.
- I did make sure that ray was installed in python 3.10 packages directory, it seems that when executing source code default\_worker.py in /home/anaconda3/envs/myvirenv\_py310/lib/python3.10/site-packages/ray/\_private/workers the script somehow cannot locate ray.

I am very confused and stuck on how to debug further, any tips will be very helpful. Thanks!

---

<div class="post-metadata">

**Author:** ![chvbs2000](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chvbs2000](https://discuss.ray.io/u/chvbs2000)\
**Post date:** [October 30, 2023, 7:16pm UTC](https://discuss.ray.io/t/raylet-modulenotfounderror-no-module-named-ray-with-installed-ray/12625/2 "2023-10-30T19:16:57Z")

</div>

> [@chvbs2000](#):
>
> ```auto
> (raylet) File "/home/anaconda3/envs/myvirenv_py310/lib/python3.10/site-packages/ray/_private/workers/default_worker.py", line 7, in <module>
> (raylet) import ray
> (raylet) ModuleNotFoundError: No module named 'ray'
> 
> ```

Just update about how we solved this issue:

The issue happened because the script running ray in virtual env was trying to find intalled libraries from python base directs but not from libraries installed in virtual env, to solve this issue simply change codes in ray.init():

```auto
ray.init({'conda':'<virtual env name>'})

```
