Adding index option to pip runtime_env

How severe does this issue affect your experience of using Ray?

  • None: Just asking a question out of curiosity

I don’t see an ability to specify an index for pip deps installed with the runtime_env. Is it possible to add that?

hi thanks for reporting.
as a workaround, does setting env variable PIP_INDEX_URL solve your problem?

It does not seem to be doing anything.

Traceback (most recent call last):
  File "/Users/abhinav/src/ghost/tools/hypo/src/hypo/flows/examples/test_pip_install.py", line 3, in <module>
    ray.init(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/_private/worker.py", line 1339, in init
    ctx = builder.connect()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/client_builder.py", line 182, in connect
    client_info_dict = ray.util.client_connect.connect(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client_connect.py", line 57, in connect
    conn = ray.connect(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/__init__.py", line 252, in connect
    conn = self.get_context().connect(*args, **kw_args)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/__init__.py", line 102, in connect
    self.client_worker._server_init(job_config, ray_init_kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/worker.py", line 855, in _server_init
    raise ConnectionAbortedError(
ConnectionAbortedError: Initialization failure from server:
Traceback (most recent call last):
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 703, in Datapath
    if not self.proxy_manager.start_specific_server(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 304, in start_specific_server
    serialized_runtime_env_context = self._create_runtime_env(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 253, in _create_runtime_env
    raise RuntimeError(
RuntimeError: Failed to create runtime_env for Ray client server, it is caused by:
Traceback (most recent call last):
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 357, in _create_runtime_env_with_retry
    runtime_env_context = await asyncio.wait_for(
  File "/home/ray/anaconda3/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 312, in _setup_runtime_env
    await create_for_plugin_if_needed(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/plugin.py", line 252, in create_for_plugin_if_needed
    size_bytes = await plugin.create(uri, runtime_env, context, logger=logger)
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 473, in create
    return await task
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 455, in _create_for_hash
    await PipProcessor(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 361, in _run
    await self._install_pip_packages(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 337, in _install_pip_packages
    await check_output_cmd(pip_install_cmd, logger=logger, cwd=cwd, env=pip_env)
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/utils.py", line 101, in check_output_cmd
    raise SubprocessCalledProcessError(
ray._private.runtime_env.utils.SubprocessCalledProcessError: Run cmd[9] failed with the following details.
Command '['/tmp/ray/session_2023-05-11_12-10-38_774144_7/runtime_resources/pip/d8e1a7d71c1b151d5ff45856436f0cfc43929e81/virtualenv/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--no-cache-dir', '-r', '/tmp/ray/session_2023-05-11_12-10-38_774144_7/runtime_resources/pip/d8e1a7d71c1b151d5ff45856436f0cfc43929e81/requirements.txt']' returned non-zero exit status 1.
Last 50 lines of stdout:
    ERROR: Could not find a version that satisfies the requirement unimatch (from versions: none)
    ERROR: No matching distribution found for unimatch


It does not seem to be doing anything.

I have this set on the pod

        - name: PIP_INDEX_URL
          value: 'https://nexus.gh.st/repository/pypi/simple'

This is the error I see:

Traceback (most recent call last):
  File "/Users/abhinav/src/ghost/tools/hypo/src/hypo/flows/examples/test_pip_install.py", line 3, in <module>
    ray.init(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/_private/worker.py", line 1339, in init
    ctx = builder.connect()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/client_builder.py", line 182, in connect
    client_info_dict = ray.util.client_connect.connect(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client_connect.py", line 57, in connect
    conn = ray.connect(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/__init__.py", line 252, in connect
    conn = self.get_context().connect(*args, **kw_args)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/__init__.py", line 102, in connect
    self.client_worker._server_init(job_config, ray_init_kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/modelspy/lib/python3.10/site-packages/ray/util/client/worker.py", line 855, in _server_init
    raise ConnectionAbortedError(
ConnectionAbortedError: Initialization failure from server:
Traceback (most recent call last):
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 703, in Datapath
    if not self.proxy_manager.start_specific_server(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 304, in start_specific_server
    serialized_runtime_env_context = self._create_runtime_env(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/util/client/server/proxier.py", line 253, in _create_runtime_env
    raise RuntimeError(
RuntimeError: Failed to create runtime_env for Ray client server, it is caused by:
Traceback (most recent call last):
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 357, in _create_runtime_env_with_retry
    runtime_env_context = await asyncio.wait_for(
  File "/home/ray/anaconda3/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 312, in _setup_runtime_env
    await create_for_plugin_if_needed(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/plugin.py", line 252, in create_for_plugin_if_needed
    size_bytes = await plugin.create(uri, runtime_env, context, logger=logger)
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 473, in create
    return await task
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 455, in _create_for_hash
    await PipProcessor(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 361, in _run
    await self._install_pip_packages(
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/pip.py", line 337, in _install_pip_packages
    await check_output_cmd(pip_install_cmd, logger=logger, cwd=cwd, env=pip_env)
  File "/home/ray/anaconda3/lib/python3.10/site-packages/ray/_private/runtime_env/utils.py", line 101, in check_output_cmd
    raise SubprocessCalledProcessError(
ray._private.runtime_env.utils.SubprocessCalledProcessError: Run cmd[9] failed with the following details.
Command '['/tmp/ray/session_2023-05-11_12-10-38_774144_7/runtime_resources/pip/d8e1a7d71c1b151d5ff45856436f0cfc43929e81/virtualenv/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--no-cache-dir', '-r', '/tmp/ray/session_2023-05-11_12-10-38_774144_7/runtime_resources/pip/d8e1a7d71c1b151d5ff45856436f0cfc43929e81/requirements.txt']' returned non-zero exit status 1.
Last 50 lines of stdout:
    ERROR: Could not find a version that satisfies the requirement unimatch (from versions: none)
    ERROR: No matching distribution found for unimatch

Adding it to the runtime_env env_vars did it! Thank you!!!

2 Likes