Deploying through serve run config. YAML can be done, but deploying through serve deploy config. YAML will fail

**this is my config.yaml**

This file was generated using the serve build command on Ray v2.42.1.

proxy_location: EveryNode

http_options:

  host: 0.0.0.0

  port: 8000

grpc_options:

  port: 9000

  grpc_servicer_functions: []

logging_config:

  encoding: TEXT

  log_level: INFO

  logs_dir: null

  enable_access_log: true

applications:

- name: app1

  route_prefix: /app1

  import_path: kolors:app

  runtime_env: {}

  deployments:

  - name: KolorsText2Image
    autoscaling_config:
      min_replicas: 1
      initial_replicas: null
      max_replicas: 3
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appkolors
      num_cpus: 1.0
      num_gpus: 0.5

- name: app2

  route_prefix: /app2

  import_path: kolors_ipadapter:app

  runtime_env: {}

  deployments:

  - name: KolorsIpadImage2Image
    autoscaling_config:
      min_replicas: 1
      initial_replicas: null
      max_replicas: 3
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appkolors
      num_cpus: 1.0
      num_gpus: 1.0

- name: app3

  route_prefix: /app3

  import_path: esrgan:app

  runtime_env: {}

  deployments:

  - name: ESRGAN
    autoscaling_config:
      min_replicas: 0
      initial_replicas: null
      max_replicas: 4
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appflux
      num_cpus: 1.0
      num_gpus: 0.2

- name: app4

  route_prefix: /app4

  import_path: flux:app

  runtime_env: {}

  deployments:

  - name: FluxText2Image
    autoscaling_config:
      min_replicas: 1
      initial_replicas: null
      max_replicas: 3
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appflux
        env_vars:
          https_proxy: "http://10.0.102.225:7897"
      num_cpus: 1.0
      num_gpus: 1.0

- name: app5

  route_prefix: /app5

  import_path: flux_image2image:app

  runtime_env: {}

  deployments:

  - name: FluxImage2Image
    autoscaling_config:
      min_replicas: 1
      initial_replicas: null
      max_replicas: 3
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appflux
        env_vars:
          https_proxy: "http://10.0.102.225:7897"
      num_cpus: 1.0
      num_gpus: 1.0

- name: app6

  route_prefix: /app6

  import_path: sadtalker:app

  runtime_env: {}

  deployments:

  - name: SadTalker
    autoscaling_config:
      min_replicas: 1
      initial_replicas: null
      max_replicas: 3
      target_ongoing_requests: 2
      metrics_interval_s: 10.0
      look_back_period_s: 30.0
      smoothing_factor: 1.0
      upscale_smoothing_factor: null
      downscale_smoothing_factor: null
      upscaling_factor: null
      downscaling_factor: null
      downscale_delay_s: 30.0
      upscale_delay_s: 30.0
    ray_actor_options:
      runtime_env:
        conda: appsadtalker
      num_cpus: 1.0
      num_gpus: 0.2

this is error when serve deploy config. yaml

Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1191, in import_attr
    module = importlib.import_module(module_name)
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'kolors'

ERROR 2025-03-12 17:59:08,079 controller 919287 -- Deploying app 'app2' failed with exception:
Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1191, in import_attr
    module = importlib.import_module(module_name)
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'kolors_ipadapter'

ERROR 2025-03-12 17:59:08,080 controller 919287 -- Deploying app 'app3' failed with exception:
Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1194, in import_attr
    return getattr(module, attr_name)
AttributeError: module 'esrgan' has no attribute 'app'

ERROR 2025-03-12 17:59:08,080 controller 919287 -- Deploying app 'app4' failed with exception:
Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1191, in import_attr
    module = importlib.import_module(module_name)
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flux'

ERROR 2025-03-12 17:59:08,080 controller 919287 -- Deploying app 'app5' failed with exception:
Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1191, in import_attr
    module = importlib.import_module(module_name)
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flux_image2image'

ERROR 2025-03-12 17:59:08,080 controller 919287 -- Deploying app 'app6' failed with exception:
Traceback (most recent call last):
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/serve/_private/application_state.py", line 1158, in build_serve_application
    import_attr(import_path), args
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/site-packages/ray/_private/utils.py", line 1191, in import_attr
    module = importlib.import_module(module_name)
  File "/home/zhouhang1/miniconda3/envs/ray_sd_copy/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sadtalker'


Hi @hang_zhou, when using serve build, the pip packages your application code depend on usually need to be manually added to the runtime_env fields in your config.yaml. Here’s a link to the API reference for runtime_env: Environment Dependencies — Ray 2.43.0. For example, you can directly specify the pip packages the applications need. If you prefer to use a conda environement, you should make sure the conda env is preinstalled on each node in your Ray cluster.