==================================== ERRORS ====================================
_____________ ERROR at setup of test_ray_nan[session_catalog_hive] _____________
@pytest.fixture(scope="session")
def ray_session() -> Generator[Any, None, None]:
"""Fixture to manage Ray initialization and shutdown for tests."""
import ray
> ray.init(
ignore_reinit_error=True,
runtime_env={"working_dir": None}, # Prevent Ray from serializing the working directory to workers
)
tests/conftest.py:3037:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/ray/_private/client_mode_hook.py:107: in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.12/site-packages/ray/_private/worker.py:1798: in init
runtime_env = _maybe_modify_runtime_env(runtime_env, _skip_env_hook)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.12/site-packages/ray/_private/worker.py:1396: in _maybe_modify_runtime_env
return hook(runtime_env)
^^^^^^^^^^^^^^^^^
.venv/lib/python3.12/site-packages/ray/_private/runtime_env/uv_runtime_env_hook.py:411: in hook
if _is_path(working_dir):
^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path_or_uri = None
def _is_path(path_or_uri: str) -> bool:
"""Returns True if uri_or_path is a path and False otherwise.
IMPORTANT: This is a duplicate of ray._private.path_utils.is_path().
Why we can't import from path_utils:
- This hook runs via `uv run --no-project uv_runtime_env_hook.py` in test scenarios
- UV creates a minimal environment without dependencies installed yet
- Importing from ray._private.path_utils triggers the full Ray import chain:
ray._private.path_utils → ray/__init__.py → ray._private.worker →
ray.widgets → ray.widgets.util → packaging.version
- The 'packaging' module is not available in the minimal UV environment,
causing: ModuleNotFoundError: No module named 'packaging.version'
This duplicate implementation uses only stdlib (pathlib, urllib.parse)
to avoid the dependency issue. If you modify this function, ensure you
also update ray._private.path_utils.is_path() to keep them in sync.
"""
if not isinstance(path_or_uri, str):
> raise TypeError(f"path_or_uri must be a string, got {type(path_or_uri)}.")
E TypeError: path_or_uri must be a string, got <class 'NoneType'>.
Feature Request / Improvement
It seems that the updates of Ray fail because we set
Noneto the working directory in the test fixtures: #3313I think it would be better to set it to a temporary directory, like
/tmp/on unix based filesystems. We can leveragetmp_pathhere: https://docs.pytest.org/en/stable/how-to/tmp_path.html