Exception: The ray.global_state API cannot be used before ray.init has been called.
See original GitHub issueSystem information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS Linux release 7.5.1804 (Core)
- Modin installed from (source or binary): pip install modin
- Modin version: 0.2.5
- Python version: 3.5.2
- Ray version: 0.6.0
- Pandas version: 0.23.4
- Exact command to reproduce: python manage.py runserver with a view file starting by import modin.pandas as pd
Describe the problem
When I do
python -c 'import modin.pandas as pd'
everything works fine.
But when I try to start a django server containing the same import, I get the following error :
Exception: The ray.global_state API cannot be used before ray.init has been called.
Is modin designed to work with Django ?
Source code / logs
urlconf_module = import_module(urlconf_module)
File "/home/.pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/Projects/NoE/core/urls.py", line 3, in <module>
from core.views import (barcodes, classifications, network_samples, provider,
File "/home/Projects/NoE/core/views/sample_file_load.py", line 1, in <module>
import modin.pandas as pd
File "/home/.pyenv/versions/python352/lib/python3.5/site-packages/modin/pandas/__init__.py", line 95, in <module>
num_cpus = ray.global_state.cluster_resources()["CPU"]
File "/home/.pyenv/versions/python352/lib/python3.5/site-packages/ray/experimental/state.py", line 754, in cluster_resources
clients = self.client_table()
File "/home/.pyenv/versions/python352/lib/python3.5/site-packages/ray/experimental/state.py", line 321, in client_table
self._check_connected()
File "/home/.pyenv/versions/python352/lib/python3.5/site-packages/ray/experimental/state.py", line 45, in _check_connected
raise Exception("The ray.global_state API cannot be used before "
Exception: The ray.global_state API cannot be used before ray.init has been called.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
"The ray.global_state API cannot be used before ray.init has ...
When trying to use the local_mode in ray.init() I get. Exception: The ray.global_state API cannot be used before ray.init has been called.
Read more >ray._private.worker — Ray 3.0.0.dev0 - the Ray documentation
Raises: Exception: An exception is raised if the worker is not connected. ... If ray.init has not been called yet, then cache the...
Read more >ray._private.state — Ray 3.0.0.dev0 - the Ray documentation
getLogger(__name__) class GlobalState: """A class used to interface with the Ray control ... An exception is raised if ray.init() has not been called...
Read more >Ray Core API — Ray 2.2.0 - the Ray documentation
This specifies the maximum number of times that a given worker can execute the given remote function before it must exit (this can...
Read more >ray.cluster_utils — Ray 2.2.0 - the Ray documentation
After this call returns, you can connect to the cluster with ray.init("auto"). ... global state accessor for fetching GCS table. self.global_state = ray....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, Actually it works ! It also works when I do :
Now the problem comes from read_excel function… I used to use " encoding=‘latin1’ " which seems to be an unknown keyword with modin but works with panda. I mean with the above import lines I get the following error :
read_excel() got an unexpected keyword argument 'encoding'
But if I replace import modin.pandas as pd by import pandas as pd it works… Should I open an other ticket ?
Thanks for your help.
Closing this. Feel free to reopen if the discussion should continue or if issue was not resolved.