Both CPP and Python tests cannot be built and fail with a successful build from source

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

  • High: It blocks me to complete my task.

I was trying to build Ray 2.9.1(both C++ and Python) from scratch in WSL Ubuntu 20.04 Environment following the official guide. The build is successful. However, I encountered several issues when I wanted to build the tests and single-step debug the program to understand more about the source code.

For CPP tests, I tried to run bazel test $(bazel query 'kind(cc_test, ...)') following the doc. It threw me with this error:

ERROR: /home/nemo/ray/BUILD.bazel:795:12: Compiling src/ray/core_worker/test/core_worker_test.cc failed: (Exit 1): gcc failed: error executing command
  (cd /home/nemo/.cache/bazel/_bazel_nemo/7a958170e819e03cfcfa43da964a4968/sandbox/linux-sandbox/629/execroot/com_github_ray_project_ray && \
  exec env - \
    LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/lib64 \
    PATH='/home/nemo/.cache/bazelisk/downloads/bazelbuild/bazel-5.4.1-linux-x86_64/bin:/home/nemo/bin:/home/nemo/.modular/pkg/packages.modular.com_mojo/bin:/usr/local/cuda/bin:/home/nemo/.local/bin:/home/nemo/.cargo/bin:/home/nemo/.local/bin:/home/nemo/.modular/pkg/packages.modular.com_mojo/bin:/home/nemo/.nvm/versions/node/v14.21.3/bin:/home/nemo/anaconda3/envs/raybuild2.9.1/bin:/home/nemo/anaconda3/condabin:/usr/local/cuda/bin:/home/nemo/.local/bin:/home/nemo/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/libnvvp:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2020.2.1:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/dotnet:/mnt/c/Program Files/Calibre2:/mnt/c/Program Files/Kubernetes/Minikube:/mnt/c/minikube:/mnt/c/Users/chenf/scoop/shims:/mnt/c/Users/chenf/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/chenf/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64:/snap/bin' \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g '-std=c++0x' -MD -MF bazel-out/k8-dbg/bin/_objs/core_worker_test/core_worker_test.pic.d '-frandom-seed=bazel-out/k8-dbg/bin/_objs/core_worker_test/core_worker_test.pic.o' -fPIC -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_SEPARATE_COMPILATION -DCARES_STATICLIB -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_FILESYSTEM_HAS_POSIX_AT_APIS -iquote . -iquote bazel-out/k8-dbg/bin -iquote external/com_github_redis_hiredis -iquote bazel-out/k8-dbg/bin/external/com_github_redis_hiredis -iquote external/boringssl -iquote bazel-out/k8-dbg/bin/external/boringssl -iquote external/com_github_google_flatbuffers -iquote bazel-out/k8-dbg/bin/external/com_github_google_flatbuffers -iquote external/com_google_protobuf -iquote bazel-out/k8-dbg/bin/external/com_google_protobuf -iquote external/com_google_absl -iquote bazel-out/k8-dbg/bin/external/com_google_absl -iquote external/utf8_range -iquote bazel-out/k8-dbg/bin/external/utf8_range -iquote external/zlib -iquote bazel-out/k8-dbg/bin/external/zlib -iquote external/boost -iquote bazel-out/k8-dbg/bin/external/boost -iquote external/com_github_spdlog -iquote bazel-out/k8-dbg/bin/external/com_github_spdlog -iquote external/com_google_googletest -iquote bazel-out/k8-dbg/bin/external/com_google_googletest -iquote external/nlohmann_json -iquote bazel-out/k8-dbg/bin/external/nlohmann_json -iquote external/com_github_jupp0r_prometheus_cpp -iquote bazel-out/k8-dbg/bin/external/com_github_jupp0r_prometheus_cpp -iquote external/civetweb -iquote bazel-out/k8-dbg/bin/external/civetweb -iquote external/com_github_madler_zlib -iquote bazel-out/k8-dbg/bin/external/com_github_madler_zlib -iquote external/io_opencensus_cpp -iquote bazel-out/k8-dbg/bin/external/io_opencensus_cpp -iquote external/com_github_grpc_grpc -iquote bazel-out/k8-dbg/bin/external/com_github_grpc_grpc -iquote external/com_google_googleapis -iquote bazel-out/k8-dbg/bin/external/com_google_googleapis -iquote external/upb -iquote bazel-out/k8-dbg/bin/external/upb -iquote external/com_github_cncf_udpa -iquote bazel-out/k8-dbg/bin/external/com_github_cncf_udpa -iquote external/com_envoyproxy_protoc_gen_validate -iquote bazel-out/k8-dbg/bin/external/com_envoyproxy_protoc_gen_validate -iquote external/com_github_cares_cares -iquote bazel-out/k8-dbg/bin/external/com_github_cares_cares -iquote external/com_googlesource_code_re2 -iquote bazel-out/k8-dbg/bin/external/com_googlesource_code_re2 -iquote external/envoy_api -iquote bazel-out/k8-dbg/bin/external/envoy_api -iquote external/opencensus_proto -iquote bazel-out/k8-dbg/bin/external/opencensus_proto -iquote external/msgpack -iquote bazel-out/k8-dbg/bin/external/msgpack -iquote external/io_opencensus_proto -iquote bazel-out/k8-dbg/bin/external/io_opencensus_proto -iquote external/rules_cc -iquote bazel-out/k8-dbg/bin/external/rules_cc -iquote external/bazel_tools -iquote bazel-out/k8-dbg/bin/external/bazel_tools -Ibazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/gcs -Ibazel-out/k8-dbg/bin/external/com_github_redis_hiredis/_virtual_includes/hiredis -Ibazel-out/k8-dbg/bin/_virtual_includes/node_manager_rpc -Ibazel-out/k8-dbg/bin/_virtual_includes/grpc_common_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/stats_metric -Ibazel-out/k8-dbg/bin/src/ray/util/_virtual_includes/util -Ibazel-out/k8-dbg/bin/_virtual_includes/aligned_alloc -Ibazel-out/k8-dbg/bin/_virtual_includes/sha256 -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_nowkt -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/arena -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/arena_align -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/stubs/_virtual_includes/lite -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/port_def -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/arena_allocation_policy -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/arena_config -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/arena_cleanup -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/string_block -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/varint_shuffle -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/io -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/io_win32 -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/gzip_stream -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/stubs/_virtual_includes/stubs -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/printer -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/zero_copy_sink -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/io/_virtual_includes/tokenizer -Ibazel-out/k8-dbg/bin/external/com_github_spdlog/_virtual_includes/spdlog -Ibazel-out/k8-dbg/bin/external/com_github_jupp0r_prometheus_cpp/pull/_virtual_includes/pull -Ibazel-out/k8-dbg/bin/external/com_github_jupp0r_prometheus_cpp/core/_virtual_includes/core -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/asio -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/event_stats -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/ray_config -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/grpc_util -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/status -Ibazel-out/k8-dbg/bin/external/com_google_googleapis -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src -Ibazel-out/k8-dbg/bin/external/com_github_grpc_grpc -Ibazel-out/k8-dbg/bin/external/com_github_cncf_udpa -Ibazel-out/k8-dbg/bin/external/com_envoyproxy_protoc_gen_validate -Ibazel-out/k8-dbg/bin/external/envoy_api -Ibazel-out/k8-dbg/bin/external/opencensus_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/_virtual_includes/protobuf -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/any_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/api_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/source_context_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/type_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/duration_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/empty_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/struct_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/timestamp_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/wrappers_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/compiler/_virtual_includes/importer -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/delimited_message_util -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/differencer -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/field_mask_util -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/json_util -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/json -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/parser -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/descriptor_traits -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/lexer -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/message_path -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/zero_copy_buffered_stream -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/untyped_message -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/type_resolver_util -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/descriptor_legacy -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/unparser -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/json/_virtual_includes/writer -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/time_util -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/id -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/constants -Ibazel-out/k8-dbg/bin/external/msgpack/_virtual_includes/msgpack -Ibazel-out/k8-dbg/bin/external/msgpack/_virtual_includes/_msgpack -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/compiler/_virtual_includes/plugin_proto -Ibazel-out/k8-dbg/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/descriptor_proto -Ibazel-out/k8-dbg/bin/_virtual_includes/ray_common -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/file_system_monitor -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/memory_monitor -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/network -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/ray_syncer -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/task_common -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/ray_object -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/runtime_env -Ibazel-out/k8-dbg/bin/src/ray/common/_virtual_includes/test_util -Ibazel-out/k8-dbg/bin/_virtual_includes/stats_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/reporter_rpc -Ibazel-out/k8-dbg/bin/_virtual_includes/gcs_client_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/gcs_pub_sub_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/gcs_service_rpc -Ibazel-out/k8-dbg/bin/_virtual_includes/pubsub_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/pubsub_rpc -Ibazel-out/k8-dbg/bin/_virtual_includes/redis_client -Ibazel-out/k8-dbg/bin/_virtual_includes/redis_store_client -Ibazel-out/k8-dbg/bin/_virtual_includes/plasma_client -Ibazel-out/k8-dbg/bin/_virtual_includes/raylet_client_lib -Ibazel-out/k8-dbg/bin/_virtual_includes/worker_rpc -isystem external/boringssl/src/include -isystem bazel-out/k8-dbg/bin/external/boringssl/src/include -isystem external/com_github_google_flatbuffers/include -isystem bazel-out/k8-dbg/bin/external/com_github_google_flatbuffers/include -isystem external/zlib -isystem bazel-out/k8-dbg/bin/external/zlib -isystem external/boost -isystem bazel-out/k8-dbg/bin/external/boost -isystem external/boost/libs/math/include_private -isystem bazel-out/k8-dbg/bin/external/boost/libs/math/include_private -isystem external/com_github_spdlog -isystem bazel-out/k8-dbg/bin/external/com_github_spdlog -isystem external/com_github_spdlog/include -isystem bazel-out/k8-dbg/bin/external/com_github_spdlog/include -isystem external/com_google_googletest/googlemock -isystem bazel-out/k8-dbg/bin/external/com_google_googletest/googlemock -isystem external/com_google_googletest/googlemock/include -isystem bazel-out/k8-dbg/bin/external/com_google_googletest/googlemock/include -isystem external/com_google_googletest/googletest -isystem bazel-out/k8-dbg/bin/external/com_google_googletest/googletest -isystem external/com_google_googletest/googletest/include -isystem bazel-out/k8-dbg/bin/external/com_google_googletest/googletest/include -isystem external/nlohmann_json/single_include -isystem bazel-out/k8-dbg/bin/external/nlohmann_json/single_include -isystem external/civetweb/include -isystem bazel-out/k8-dbg/bin/external/civetweb/include -isystem external/com_github_madler_zlib -isystem bazel-out/k8-dbg/bin/external/com_github_madler_zlib -isystem external/com_github_grpc_grpc/api/include -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/api/include -isystem external/com_github_grpc_grpc/include -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/include -isystem external/com_github_grpc_grpc/src/core/ext/upb-generated -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/ext/upb-generated -isystem external/com_github_grpc_grpc/src/core/ext/upbdefs-generated -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/ext/upbdefs-generated -isystem external/com_github_grpc_grpc/src/core/api/include -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/api/include -isystem external/com_github_grpc_grpc/src/core/include -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/include -isystem external/com_github_grpc_grpc/src/core/src/core/ext/upb-generated -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/src/core/ext/upb-generated -isystem external/com_github_grpc_grpc/src/core/src/core/ext/upbdefs-generated -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/src/core/src/core/ext/upbdefs-generated -isystem external/com_github_grpc_grpc/third_party/address_sorting/include -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/third_party/address_sorting/include -isystem external/com_github_cares_cares/include -isystem bazel-out/k8-dbg/bin/external/com_github_cares_cares/include -isystem external/com_github_cares_cares -isystem bazel-out/k8-dbg/bin/external/com_github_cares_cares -isystem external/com_github_grpc_grpc/third_party/xxhash -isystem bazel-out/k8-dbg/bin/external/com_github_grpc_grpc/third_party/xxhash -fPIC '-std=c++17' -Werror -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/ray/core_worker/test/core_worker_test.cc -o bazel-out/k8-dbg/bin/_objs/core_worker_test/core_worker_test.pic.o)
# Configuration: db4ea28a0e7d68f0189ff8c0c193d95305524256120584559df094e645a19ca2
# Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
src/ray/core_worker/test/core_worker_test.cc: In member function 'int ray::core::CoreWorkerTest::GetActorPid(const ray::ActorID&, std::unordered_map<std::__cxx11::basic_string<char>, double>&)':
src/ray/core_worker/test/core_worker_test.cc:207:50: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  207 |       actor_id, func, args, options, task_returns);
      |                                                  ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
src/ray/core_worker/test/core_worker_test.cc: In member function 'void ray::core::CoreWorkerTest::TestActorTask(std::unordered_map<std::__cxx11::basic_string<char>, double>&)':
src/ray/core_worker/test/core_worker_test.cc:303:54: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  303 |           actor_id, func, args, options, task_returns);
      |                                                      ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
src/ray/core_worker/test/core_worker_test.cc:351:52: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  351 |         actor_id, func, args, options, task_returns);
      |                                                    ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
src/ray/core_worker/test/core_worker_test.cc: In member function 'void ray::core::CoreWorkerTest::TestActorRestart(std::unordered_map<std::__cxx11::basic_string<char>, double>&)':
src/ray/core_worker/test/core_worker_test.cc:418:54: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  418 |           actor_id, func, args, options, task_returns);
      |                                                      ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
src/ray/core_worker/test/core_worker_test.cc: In member function 'void ray::core::CoreWorkerTest::TestActorFailure(std::unordered_map<std::__cxx11::basic_string<char>, double>&)':
src/ray/core_worker/test/core_worker_test.cc:464:54: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  464 |           actor_id, func, args, options, task_returns);
      |                                                      ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
src/ray/core_worker/test/core_worker_test.cc: In member function 'virtual void ray::core::SingleNodeTest_TestDirectActorTaskSubmissionPerf_Test::TestBody()':
src/ray/core_worker/test/core_worker_test.cc:630:52: error: no matching function for call to 'ray::core::CoreWorker::SubmitActorTask(ray::ActorID&, ray::core::RayFunction&, std::vector<std::unique_ptr<ray::TaskArg> >&, ray::core::TaskOptions&, std::vector<ray::rpc::ObjectReference>&)'
  630 |         actor_id, func, args, options, task_returns);
      |                                                    ^
In file included from src/ray/core_worker/test/core_worker_test.cc:15:
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note: candidate: 'ray::Status ray::core::CoreWorker::SubmitActorTask(const ray::ActorID&, const ray::core::RayFunction&, const std::vector<std::unique_ptr<ray::TaskArg> >&, const ray::core::TaskOptions&, int, bool, const string&, std::vector<ray::rpc::ObjectReference>&, ray::TaskID)'
  935 |   Status SubmitActorTask(const ActorID &actor_id,
      |          ^~~~~~~~~~~~~~~
bazel-out/k8-dbg/bin/_virtual_includes/core_worker_lib/ray/core_worker/core_worker.h:935:10: note:   candidate expects 9 arguments, 5 provided
INFO: Elapsed time: 85.640s, Critical Path: 84.45s
INFO: 131 processes: 88 internal, 43 linux-sandbox.
FAILED: Build did NOT complete successfully
//:accessor_test                                                      NO STATUS
//:actor_manager_test                                                 NO STATUS
//:callback_reply_test                                                NO STATUS
//:chaos_redis_store_client_test                                      NO STATUS
//:cluster_resource_manager_test                                      NO STATUS
//:cluster_resource_scheduler_2_test                                  NO STATUS
//:cluster_resource_scheduler_test                                    NO STATUS
//:cluster_task_manager_test                                          NO STATUS
//:concurrency_group_manager_test                                     NO STATUS
//:core_worker_resubmit_queue_test                                    NO STATUS
//:create_request_queue_test                                          NO STATUS
//:dependency_manager_test                                            NO STATUS
//:dependency_resolver_test                                           NO STATUS
//:direct_actor_transport_mock_test                                   NO STATUS
//:direct_actor_transport_test                                        NO STATUS
.... (a lot of tests with NO STATUS)
//src/ray/util/tests:sample_test                                      NO STATUS
//src/ray/util/tests:sequencer_test                                   NO STATUS
//src/ray/util/tests:signal_test                                      NO STATUS
//src/ray/util/tests:throttler_test                                   NO STATUS
//src/ray/util/tests:util_test                                        NO STATUS
//:core_worker_test                                             FAILED TO BUILD
//:actor_creator_test                                                    PASSED in 1.5s
//:actor_submit_queue_test                                               PASSED in 1.8s
//:asio_test                                                             PASSED in 1.6s

Then I reran the tests with the filter bazel test $(bazel query 'kind(cc_test, ...)') --test_filter=actor_manager_test, this time more tests passed (but it seems the whole test suites still get built and ran, which mean the filter does not work), but the core_worker_test still failed with the same error.

Then for the Python test, I tried this python -m pytest -v -s python/ray/tests/test_basic.py

The first few tests passed, however, the following tests failed with the errors thrown “circular imports” I also checked the GitHub issues on this but it seems none of them can solve my case.
For example,

   def test_import_ray_does_not_import_grpc():
        # First unload grpc and ray
        if "grpc" in sys.modules:
            del sys.modules["grpc"]
        if "ray" in sys.modules:
            del sys.modules["ray"]

        # Then import ray from scratch
>       import ray  # noqa: F401

python/ray/tests/test_basic.py:1129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
python/ray/__init__.py:75: in <module>
    _configure_system()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _configure_system():
        import os
        import platform
        import sys

        """Wraps system configuration to avoid 'leaking' variables into ray."""

        # Sanity check pickle5 if it has been installed.
        if "pickle5" in sys.modules:
            if sys.version_info >= (3, 8):
                logger.warning(
                    "Package pickle5 becomes unnecessary in Python 3.8 and above. "
                    "Its presence may confuse libraries including Ray. "
                    "Please uninstall the package."
                )

            import pkg_resources

            try:
                version_info = pkg_resources.require("pickle5")
                version = tuple(int(n) for n in version_info[0].version.split("."))
                if version < (0, 0, 10):
                    logger.warning(
                        "Although not used by Ray, a version of pickle5 that leaks memory "
                        "is found in the environment. Please run 'pip install pickle5 -U' "
                        "to upgrade."
                    )
            except pkg_resources.DistributionNotFound:
                logger.warning(
                    "You are using the 'pickle5' module, but "
                    "the exact version is unknown (possibly carried as "
                    "an internal component by another module). Please "
                    "make sure you are using pickle5 >= 0.0.10 because "
                    "previous versions may leak memory."
                )

        # Importing psutil & setproctitle. Must be before ray._raylet is
        # initialized.
        thirdparty_files = os.path.join(
            os.path.abspath(os.path.dirname(__file__)), "thirdparty_files"
        )
        sys.path.insert(0, thirdparty_files)

        if (
            platform.system() == "Linux"
            and "Microsoft".lower() in platform.release().lower()
        ):
            import ray._private.compat  # noqa: E402

>           ray._private.compat.patch_psutil()
E           AttributeError: partially initialized module 'ray' has no attribute '_private' (most likely due to a circular import)

python/ray/__init__.py:60: AttributeError

 python/ray/tests/test_basic.py::test_import_ray_does_not_import_grpc ⨯

The weird thing is If I ran some of the single test withpython -m pytest -v -s python/ray/tests/test_basic.py::test_put_get , it passed, is this supposed to be normal?

python -m pytest -v -s python/ray/tests/test_basic.py::test_put_get
Test session starts (platform: linux, Python 3.9.18, pytest 7.0.1, pytest-sugar 0.9.5)
cachedir: .pytest_cache
rootdir: /home/nemo/ray, configfile: pytest.ini
plugins: forked-1.4.0, shutil-1.7.0, sugar-0.9.5, rerunfailures-11.1.2, asyncio-0.16.0, timeout-2.1.0, httpserver-1.0.6, sphinx-0.5.1.dev0, docker-tools-3.1.3, anyio-3.7.1, virtualenv-1.7.0, lazy-fixture-0.6.3
timeout: 180.0s
timeout method: signal
timeout func_only: False
collecting ... 2024-01-27 23:50:50,037  INFO worker.py:1724 -- Started a local Ray instance.

 python/ray/tests/test_basic.py::test_put_get ✓                                              100% ██████████

Results (5.40s):
       1 passed

In general, I think the question for me is that it is not very clear about the overall development workflow (for the internal codebase). For example, with VScode, how can we build a local environment, ran and debug the tests and make sure the changes we made do not fail the tests before submitting CI?

I also encountered this exact error when building and testing inside a clean container environment. The build is based on release/2.9.1. Any insights would be very helpful, thanks!

Unfortunately core_worker_test looks like it’s out of date. We’ll work on removing it.

I haven’t been able to reproduce the test_basic.py issues that you ran into. Does starting Ray from your compiled version work?

I’ve started a github issue thread to track this issue of keeping our contributor guide up-to-date. If you find any fixes for the build process, be sure to let us know there. Thanks!

Thanks for confirming the core_worker_test issue!

For the Python test, yes the compiled version of Ray seems to work for a simple example described here What is Ray Core? — Ray 2.9.2 I can see correct results outputted and observe the ray cluster created. However for certain tests like “test_import_ray_does_not_import_grpc”, it still throws me that error. I will try to rebuild in a clean environment with ray 2.9.2 and report back.

Will follow the issue created, thx again.

@Stephanie_Wang I rebuilt ray 2.9.2 in the same WSL environment in a clean conda environment with Python 3.10.

After the build it first pops out:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pynvim 0.4.3 requires greenlet, which is not installed.

Successfully installed aiosignal-1.3.1 attrs-23.2.0 certifi-2024.2.2 charset-normalizer-3.3.2 click-8.1.7 filelock-3.13.1 frozenlist-1.4.1 idna-3.6 jsonschema-4.21.1 jsonschema-specifications-2023.12.1 msgpack-1.0.7 packaging-23.2 protobuf-4.25.2 pyyaml-6.0.1 ray-2.9.2 referencing-0.33.0 requests-2.31.0 rpds-py-0.18.0 urllib3-2.2.0

Seem ray is still being built successfully so I ignore the pynvim thing. Then I ran the same command “python -m pytest -v -s python/ray/tests/test_basic.py”, it first prompted that I don’t have pytest, so I did “pip install pytest”. Then the next thing I need to install is psutil as

ImportError while loading conftest '/home/nemo/ray292/ray/python/ray/tests/conftest.py'.
python/ray/tests/conftest.py:18: in <module>
    import psutil
E   ModuleNotFoundError: No module named 'psutil'

So I did pip install psutil, and it installs this version:
Using cached psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Then for the failed tests they all complain

E           AttributeError: partially initialized module 'ray' has no attribute '_private' (most likely due to a circular import)

whenever they encounter this line

ray._private.compat.patch_psutil()

the context of this code is:

        if (
            platform.system() == "Linux"
            and "Microsoft".lower() in platform.release().lower()
        ):
            import ray._private.compat  # noqa: E402

>           ray._private.compat.patch_psutil()
python/ray/__init__.py:60: AttributeError

This seems to be sth that only WSL would go in here.

But if I open a terminal and directly type

import ray
import ray._private.compat
ray._private.compat.patch_psutil()

it won’t throw any error.

So I added these few lines in the tests and the test seems to go through … but I’m not sure if this is an issue:

def  test_default_worker_import_dependency(shutdown_only):   
...
    sys.modules.pop("ray", None)
    assert "ray" not in sys.modules
    for dep in blocked_deps:
        sys.modules.pop(dep, None)
        assert dep not in sys.modules
####### I added
    ray_related = []
    for k in sys.modules:
        if 'ray.' in k:
            ray_related.append(k)
    for k in ray_related:
        sys.modules.pop(k, None)
####### end
    # This imports the python worker.
    import ray._private.workers.default_worker  # noqa: F401
    ray_related = []
    for k in sys.modules:
        if 'ray.' in k:
            ray_related.append(k)
    for k in ray_related:
        sys.modules.pop(k, None)

I guess that although it pops out the “ray” in the sys modules, however, due to the test setup, a lot of ray._private.xxx modules get partially imported. What I did is to pop all the ray-related libraries and this particular test runs fine. It also algined with what I observed that when I ran the test alone without pytest setup, then the test will go through.

Not sure whether this needs to be fixed though if this cannot get reproduced at your side @Stephanie_Wang .

Thanks for looking into this more! Really helpful.

Hmm I’m not able to reproduce the error locally, although I’m not starting from a completely clean environment. Can you try rerunning pip install -e . --verbose and following the directions here to address the psutil issue and see if that works?

Sorry for causing the confusion in the previous post about psutil.

I think the problem I encountered is probably not related to that particular case of psutil? because i also see this circular issue in other tests as well. In particular, if a test tries to pop/del ray from sys modules (e.g., test_default_worker_import_dependency as shown above) it will complain about this “circular import issue”) even if I manually remove the psutil function in the _configure_system, other places when import ray._private.xx gets called still throw this issue.

If I poped out all the ray related modules, like what I did in my previous comment, i see this issue gone and the test passed. So far this happens for both test_import_ray_does_not_import_grpc and test_default_worker_import_dependency

in the test_import_ray_does_not_import_grpc I did the changes, you could see previously this test is failed, but after the changes it passed.

Not sure if this is something that existing or future tests should avoid (i.e., when del or pop ray, make sure all partially imported ray modules are also deleted, in this case it was partially imported by conftest.py for pytest setup? If you think this is an issue I could help create a pull request.