7
import modin.pandas as pd

I am importing modin.pandas library in my windows 10 machine but getting error

"AttributeError: module 'ray' has no attribute 'utils'"

Anything missed while installing modin library?

Red
  • 26,798
  • 7
  • 36
  • 58
Learnings
  • 2,780
  • 9
  • 35
  • 55
  • 1
    As you are using `ray` are you importing it? Eg `import ray ray.init(plasma_directory="/path/to/custom/dir", object_store_memory=10**10) # Modin will connect to the existing Ray environment import modin.pandas as pd`? – Gonçalo Peres May 01 '21 at 11:50
  • 1
    Also, prior to the question above, did you install Ray? `pip install modin[ray]`? This will pip install modin dependencies and Ray to run on Ray – Gonçalo Peres May 01 '21 at 11:52
  • @GonçaloPeres龚燿禄 thanks for the reply, Yes I have installed like "pip install modin[ray]" but still same problem, import ray - no errors, but only errors on import modin.pandas – Learnings May 01 '21 at 13:16
  • And as for the first question, are you importing ray? – Gonçalo Peres May 01 '21 at 13:20
  • @GonçaloPeres龚燿禄 No I am not importing ray, but I tried with importing ray and same issues in both the cases – Learnings May 01 '21 at 13:53
  • As I don't have much time for debugging right now, I suggest you to share your issue [here](https://github.com/modin-project/modin/issues). – Gonçalo Peres May 01 '21 at 13:57
  • It seems you got incompatibility between ray and modin. Could you try uninstall both and then `pip install ray==1.1` finally install modin via `pip install modin` – Paulo Marques Jun 25 '21 at 18:56

4 Answers4

3

"AttributeError: module 'ray' has no attribute 'utils'"

It looks like, you should be able to fix the issue if you just install the 1.1 version of ray, by doing the following :

pip install ray==1.1

The modin.pandas creators haven't release support for versions of ray greater then 1.1.

Here is the discussion thread on github : https://github.com/modin-project/modin/issues/3059

Akash Dubey
  • 304
  • 1
  • 11
  • This _is_ the version that works for me today. So, it should have got the bounty in first place. But I voted for the [answer](https://stackoverflow.com/a/68155285/8854526) by @Ann.Zenn as it's more generalized... and should withstand the test of time-- in case, say, when `ray` upgrades its support for versions beyond `1.1` ! – Partha D. Jul 02 '21 at 08:09
  • @ParthaD. Glad it helped. Don't worry about the bounty :) – Akash Dubey Jul 02 '21 at 08:15
2

I followed the below steps to install Modin using Ray execution engine. Install Modin dependencies and Ray to run on Ray -

pip install modin[ray] 

Also, please customize your Ray environment for use in Modin using the below commands.

import ray
ray.init()
import modin.pandas as pd

Please check out Intel Distribution of Modin (https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-of-modin.html#gs.14j7r0) and Modin official page (https://modin.readthedocs.io/en/stable/) for installation issues and to accelerate pandas workflow on Intel architectures.

Ramya R
  • 163
  • 8
1

Check which version of ray you have; ray.utils used to be called ray.experimental.

You'll either need to upgrade version of the module you're using that has ray as a dependency (meaning the module currently uses the out-of-date version of ray), or downgrade the version of the ray (to be compatible with the module you're using).

Red
  • 26,798
  • 7
  • 36
  • 58
  • It's true I changed the version of quite a few modules... which apparently caused the error (previously it was working fine). And at some point of time (I don't remember) it got all right again. At present, I have `pandas==1.1.5`, `modin==0.8.3` and `ray==1.1.0` ...just to assist someone with my use case, if at all that's necessary ! – Partha D. Jul 02 '21 at 08:05
0

I also had the same issue. For me I uninstalled the existing modin and ray package from my instance and then restarted the kernal and then used the following command:

pip install modin[ray]

It then worked for me. If you are running it in google Colab you can find more information here.

aninda
  • 31
  • 3
  • Hello. Welcome to Stack Overflow. I'm afraid the OP addressed that this didn't work. See their comment here: https://stackoverflow.com/questions/67345646/error-while-importing-library-modin-in-python-3-6/68175591#comment119038763_67345646 – Red Jun 29 '21 at 16:20