Build error in local

hi, i build ray from source in my local, met following errors
the error occurs on ubuntu 20.04 and 24.04, I tried many times but unable to resolve
please help!

ln -sf libjemalloc.so.2 lib/libjemalloc.so
    + /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make install -j
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/bin
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/include/jemalloc
    'bin/jemalloc-config' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/bin/jemalloc-config'
    'bin/jemalloc.sh' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/bin/jemalloc.sh'
    'bin/jeprof' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/bin/jeprof'
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib/pkgconfig
    'include/jemalloc/jemalloc.h' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/include/jemalloc/jemalloc.h'
    /bin/install -c -v -m 755 lib/libjemalloc.so.2 /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib
    'lib/libjemalloc.so.2' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib/libjemalloc.so.2'
    ln -sf libjemalloc.so.2 /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib/libjemalloc.so
    Missing xsltproc.  doc/jemalloc.html not (re)built.
    'jemalloc.pc' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib/pkgconfig/jemalloc.pc'
    Missing xsltproc.  doc/jemalloc.3 not (re)built.
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/share/doc/jemalloc
    /bin/install -c -d /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/share/man/man3
    'doc/jemalloc.3' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/share/man/man3/jemalloc.3'
    'doc/jemalloc.html' -> '/home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/share/doc/jemalloc/jemalloc.html'
    + set +x
    sed: -e expression #1, char 226: unknown option to `s'
    _____ END BUILD LOGS _____
    rules_foreign_cc: Build wrapper script location: bazel-out/k8-opt/bin/external/jemalloc/libjemalloc_foreign_cc/wrapper_build_script.sh
    rules_foreign_cc: Build script location: bazel-out/k8-opt/bin/external/jemalloc/libjemalloc_foreign_cc/build_script.sh
    rules_foreign_cc: Build log location: bazel-out/k8-opt/bin/external/jemalloc/libjemalloc_foreign_cc/Configure.log

    INFO: Elapsed time: 55.673s, Critical Path: 54.49s
    INFO: 140 processes: 101 internal, 39 processwrapper-sandbox.
    FAILED: Build did NOT complete successfully
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/home/zhiqiwang/git/ray/python/setup.py", line 805, in <module>
        setuptools.setup(
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
        return run_commands(dist)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
        dist.run_commands()
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
        self.run_command(cmd)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
        self.distribution.run_command(command)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/home/zhiqiwang/venv/ray/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/home/zhiqiwang/git/ray/python/setup.py", line 793, in run
        return pip_run(self)
      File "/home/zhiqiwang/git/ray/python/setup.py", line 702, in pip_run
        build(True, BUILD_JAVA, True)
      File "/home/zhiqiwang/git/ray/python/setup.py", line 658, in build
        return bazel_invoke(
      File "/home/zhiqiwang/git/ray/python/setup.py", line 429, in bazel_invoke
        result = invoker([cmd] + cmdline, *args, **kwargs)
      File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['bazel', 'build', '--verbose_failures', '--incompatible_strict_action_env', '--', '//:ray_pkg', '//cpp:ray_cpp_pkg']' returned non-zero exit status 1.
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> See above for output.

    note: This error originates from a subprocess, and is likely not a problem with pip.
    full command: /home/zhiqiwang/venv/ray/bin/python3.10 -c '
    exec(compile('"'"''"'"''"'"'
    # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
    #
    # - It imports setuptools before invoking setup.py, to enable projects that directly
    #   import from `distutils.core` to work with newer packaging standards.
    # - It provides a clear error message when setuptools is not installed.
    # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
    #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
    #     manifest_maker: standard file '"'"'-c'"'"' not found".
    # - It generates a shim setup.py, for handling setup.cfg-only projects.
    import os, sys, tokenize

    try:
        import setuptools
    except ImportError as error:
        print(
            "ERROR: Can not execute `setup.py` since setuptools is not available in "
            "the build environment.",
            file=sys.stderr,
        )
        sys.exit(1)

    __file__ = %r
    sys.argv[0] = __file__

    if os.path.exists(__file__):
        filename = __file__
        with tokenize.open(__file__) as f:
            setup_py_code = f.read()
    else:
        filename = "<auto-generated setuptools caller>"
        setup_py_code = "from setuptools import setup; setup()"

    exec(compile(setup_py_code, filename, "exec"))
    '"'"''"'"''"'"' % ('"'"'/home/zhiqiwang/git/ray/python/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' develop --no-deps
    cwd: /home/zhiqiwang/git/ray/python/
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: There was an error checking the latest version of pip.

Hello zhiqiwangebay and welcome to the Ray community!

I took a look at the log and this line stuck out to me:

ln -sf libjemalloc.so.2 /home/zhiqiwang/.cache/bazel/_bazel_zhiqiwang@ebay.com/45d585b8413835e1c84836981be60562/sandbox/processwrapper-sandbox/720/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/external/jemalloc/libjemalloc.build_tmpdir/libjemalloc/lib/libjemalloc.so Missing xsltproc. doc/jemalloc.html not (re)built.

Do you have the xsltproc library installed and have all the dependencies installed correctly?

@christina Thanks for reply
I discovered that the root cause of the issue was the ‘@’ character in my username. I submitted a PR at [build] warning when username or homedir include @ character by zhiqiwangebay · Pull Request #52274 · ray-project/ray · GitHub to add a warning message

1 Like

Thank you for submitting a PR! :heart_hands: